How clean a place holder from a class

see07

Regular
Joined
Apr 16, 2004
Messages
78
Location
Mexico City
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.
 
Finally I attained it thus:



In WebForm1 I did:



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



And in my class I did:



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?
 
Finally I attained it changing de call function thus:

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

Greetings.

A.L.
 
Back
Top