Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 10th, 2005, 12:32 PM   #1
see07
Programmer
 
Join Date: Oct 2004
Posts: 37
Rep Power: 0 see07 is on a distinguished road
Cleaning a Place Holder from a class

Hello:
From a class I want clean a place holder contained in a web form.
I’m using this code:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;


namespace WUC_CreDes
{
public class Class1
{
public static bool Hay_PostBack()
{
WUC_CreDes.WebForm1 parent1 = (WUC_CreDes.WebForm1) this.Page;
parent1.Example.Controls.Clear();
return false;
}
}
}

Where “Example” is my place holder within the web form.

When I compile my Project it’s sending me this error: “Keyword ‘this’ is not valid in a static property, a static method or as startup of static field”.

Does somebody has some idea about how can I attain it?

Thanks you in advance.

Greetings.

A.L.
__________________
<span style='color:red'>El Hombre que tiene Amigos, debe mostrarse Amigo...</span>
see07 is offline   Reply With Quote
Old Mar 10th, 2005, 6:31 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Just remove "this".
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Mar 11th, 2005, 4:52 PM   #3
see07
Programmer
 
Join Date: Oct 2004
Posts: 37
Rep Power: 0 see07 is on a distinguished road
Thanks you Ooble:

Finally I attained it thus:

In WebForm1 I do:

bool que = WUC_CreDes.Class1.Hay_PostBack(this);

And in my class I do:

public static bool Hay_PostBack(WUC_CreDes.WebForm1 parent1)
{
parent1.Example.Controls.Clear();
return false;
}

But now I need do same from a WUC, if I do:

bool que = WUC_CreDes.Class1.Hay_PostBack(this);

I understand I need replace 'this' with web form's name, here WebForm1.aspx

Somebody know how can I do to attain it?
__________________
<span style='color:red'>El Hombre que tiene Amigos, debe mostrarse Amigo...</span>
see07 is offline   Reply With Quote
Old Mar 15th, 2005, 10:44 AM   #4
see07
Programmer
 
Join Date: Oct 2004
Posts: 37
Rep Power: 0 see07 is on a distinguished road
Finally I attained it changing de call function thus:

bool que = WUC_CreDes.Class1.Lanza(this.Page as WUC_CreDes.WebForm1);

Greetings.

A.L.
__________________
<span style='color:red'>El Hombre que tiene Amigos, debe mostrarse Amigo...</span>

Last edited by see07; Mar 15th, 2005 at 10:45 AM. Reason: wrong wording
see07 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:06 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC