see07 Posted March 14, 2005 Posted March 14, 2005 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. Quote
see07 Posted March 14, 2005 Author Posted March 14, 2005 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? Quote
see07 Posted March 15, 2005 Author Posted March 15, 2005 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.