newbie: add event to master page

  • Thread starter Thread starter Jeff
  • Start date Start date
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
 
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
 
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
 
Back
Top