newbie: add event to master page

J

Jeff

hey

asp.net 2.0

This is a very embarrassing question!

In my asp.net 2.0 project in visual web developer 2005 Express have I a
master page which I want to add code to the OnInit event. But I'm not sure
how to create the event menthod in the code behind file. In the proerties
window of the webpage I don't see any info about events.... Does this mean
that I should add the event programatically (create my own event handler
etc...)?

Jeff
 
G

Guest

well don't worry about the question it is not embarrassing at all.
Look to add an event to any page event simple know what is the event name
like OnInit event
then in your code editor, write
protected override void OnInit(EventArgs e)
{
}

once you wrote protected override (C#) or protected overridable (VB.NET) the
intellisence will display list of overridable methods for you,, all events
will start with On word..

Another way, you'll notice on your aspx page that the AutoEvenWireUp is set
to true by default, so when your event name is OnLoad you can add this method
and it will automaticly handled as an OnLoad event handler method
protected Page_Load(sender s, EventArgs e)
{
}
same for OnInit it will be Page_Init etc....

hope this could solve your issue

Regards
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
 
J

Jeff

Thanks, it helped me !


Muhammad Mosa said:
well don't worry about the question it is not embarrassing at all.
Look to add an event to any page event simple know what is the event name
like OnInit event
then in your code editor, write
protected override void OnInit(EventArgs e)
{
}

once you wrote protected override (C#) or protected overridable (VB.NET)
the
intellisence will display list of overridable methods for you,, all events
will start with On word..

Another way, you'll notice on your aspx page that the AutoEvenWireUp is
set
to true by default, so when your event name is OnLoad you can add this
method
and it will automaticly handled as an OnLoad event handler method
protected Page_Load(sender s, EventArgs e)
{
}
same for OnInit it will be Page_Init etc....

hope this could solve your issue

Regards
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
 

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