Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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?

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...