[vb->c#] Some conversion problems about handles and Master Page

C

cipcip

same question about WEB app.:
In vb i use "handles + handler class name" keyword for events, what can
i use in c#?
In vb i use the directive masterpagefile and mastertype and than i can
see all public methods, classes and vars of the master page, in c# it
seems it is not enaugh, how can i do to """see""" masterPage?
 
E

e

the samething but with different syntax, you should Combine the funtion into
the delegate chain list and the easiest way to do it C# is in your
constructor, or Page_Init for webpage

myControl/EventOnControl += MyFuctionForTheEventHandler;


you can access the page materpage trhoruh the page property, well it's
called Masterpage, cast it to your masterpage type to access all the public
interfaces

regards
erymuzuan mustapa
www.bespoke.com.my
 
C

cipcip

is it ok?:

public void Page_Init(object sender, EventArgs e)
{
this.Load += new System.EventHandler(this.Page_Load);
}

public void Page_Load(object sender, EventArgs e)
{

}


If yes, another question:

if i register events in page_init event where i regiser the init event
itself?
 
C

chanmm

cipcip,

I am not too sure what you want but what I can see is C# and master page.
Can I suggest you to download the Pet shop 4 to take a look of the code in
there. It uses C# and master page.

chanmm
 
C

cipcip

it doesn't work:
public void Page_Init(object sender, EventArgs e)
{
this.Load += new System.EventHandler(this.Page_Load);

}

public void Page_Load(object sender, EventArgs e)
{
Label1.Text="OK"

}


ifi set autoeventwireup to false the load event doesn't fire, so the
question is how to make it work when autoevent wireup is set to false?
 
T

Tom Spink

cipcip said:
it doesn't work:
public void Page_Init(object sender, EventArgs e)
{
this.Load += new System.EventHandler(this.Page_Load);

}

public void Page_Load(object sender, EventArgs e)
{
Label1.Text="OK"

}


ifi set autoeventwireup to false the load event doesn't fire, so the
question is how to make it work when autoevent wireup is set to false?

Hi cipcip,

I don't do ASP .NET, but presumably, from what I can infer, if you've set
AutoEventWireup to False, then the Page_Init method won't be called, hence
your code that assigns an event handler to this.Load will not happen.

Can't you put your 'this.Load += ...' code in the constructor?
 
T

Tom Spink

cipcip said:
where i can find page costructor?

Hi,

A constructor takes the form of:

<scope> <class-name> ( <parameters> )
{
<block>
}

So, if you're class is called 'Foo', your default constructor will look like
this:

public Foo ( )
{
...
}

Like I said, I don't do ASP .NET, so I'm not sure if you're constructor has
been defined elsewhere. If you're using the VS .NET IDE, I'm sure you can
browse to the constructor, using the dropdowns in the code-editor.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top