Page_Load Event problem in MasterPage and ContentPage

Posted by Sidharthgs6 under ASP.NET on 8/9/2012 | Points: 10 | Views : 1175 | Status : [Member] | Replies : 2
Hi,

In my website

I have one master page name is CRM.master

Then i add one web form complaint.aspx.cs with select CRM.master page

My problem

In complaint.aspx.cs web form have one DropdownList name Cmbo_Station

i write the code page load event in complaint.aspx.cs is

protected void Page_Load(object sender, EventArgs e)
{
Cmbo_Station.Text = "Select";

}

i run the code but the text is not display

then i debug the code the problem is CRM.master page also having empty Page_Load event ie

In CRM.master

protected void Page_Load(object sender, EventArgs e)
{

}

so CRM.master page_Load event is executed.

How to avoid this i want execute complaint.aspx.cs Page_Load Event




Responses

Posted by: Vikash on: 8/12/2012 [Member] Starter | Points: 25

Up
0
Down
For achieving your result
you have to write following
Cmbo_Station.Items.Add("Select");

in place of
Cmbo_Station.Text = "Select";

i hope it will help you.........

Regards,
Vikash Pathak

Sidharthgs6, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 8/13/2012 [Member] Starter | Points: 25

Up
0
Down
In asp copde behind page,write lik this:
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IspostBack)
{
Cmbo_Station.Text = "Select";
}

}


Sidharthgs6, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response