I have a master page in asp.net C# under it i have a content page.
when i take button on master page then on runtime on button click content form load event called on button click.
on every button click it happened.
any body face this type of problem ?
why?
Loading


Suthish NairRank #92 · 22.8K reputationPosted Oct 13, 2010, 11:03 AM EDT
if problem solved, please mark as answer...
Suthish NairRank #92 · 22.8K reputationPosted Oct 7, 2010, 3:24 AM EDT
readon: http://odetocode.com/Articles/450.aspx
Vikas AhlawatRank #2,648 · 525 reputationPosted Oct 7, 2010, 4:28 AM EDT
protected void btnCategory_Click(object sender, EventArgs e)
{
Response.Redirect("~/Forms/frmView.aspx?formname=Category");
}
content page onload even code
protected void Page_Load(object sender, EventArgs e)
{
txtFromDate.Text = DateTime.Now.AddMonths(-1).ToString("MM/dd/yyyy");
txtToDate.Text = DateTime.Now.ToString("MM/dd/yyyy");
//Session["is_starting"]=
if (Session["is_starting"] == "yes")
{
RefreshData("Category");
Session["is_starting"] = null;
}
else
{
string formvalue = Request.QueryString["formname"].ToString(); //when i click on the button then error occur here because button click event not called and when i make comment to these three lines then button click event ( btnCategory_Click) execute successfully.
Response.Write("");
RefreshData(formvalue);
// RefreshData("StudentProspects");
}
//Response.Write("");
}
Suthish NairRank #92 · 22.8K reputationPosted Oct 7, 2010, 4:55 AM EDT
if (!IsPostBack) {}Vikas AhlawatRank #2,648 · 525 reputationPosted Oct 7, 2010, 8:35 PM EDT
if (!IsPostBack) {}Suthish NairRank #92 · 22.8K reputationPosted Oct 7, 2010, 10:23 PM EDT
Vikas AhlawatRank #2,648 · 525 reputationPosted Oct 7, 2010, 10:33 PM EDT
//when i click on the button then error occur here because button click event
protected void btnCategory_Click(object sender, EventArgs e)
{
Response.Redirect("~/Forms/frmView.aspx?formname=Category");
}
not called and when i make comment to these three lines then button click event ( btnCategory_Click) execute successfully.
you can help me by check it http://www.c-sharpcorner.com/Forums/UploadFile/96725
Suthish NairRank #92 · 22.8K reputationPosted Oct 7, 2010, 11:31 PM EDT
Vikas AhlawatRank #2,648 · 525 reputationPosted Oct 8, 2010, 1:42 AM EDT
Can you give example
of passing query string from master page(button click event) to content page
Suthish NairRank #92 · 22.8K reputationPosted Oct 8, 2010, 2:52 AM EDT
Vikas AhlawatRank #2,648 · 525 reputationPosted Oct 8, 2010, 3:05 AM EDT
In this query sting always null because contant form load event called before master page button click event.
i want to display query sting value when content form load event call
Suthish NairRank #92 · 22.8K reputationPosted Oct 8, 2010, 8:23 AM EDT
karthick kumar106 reputationPosted Oct 8, 2010, 8:43 AM EDT
You can check some conditions like
if( Request.QueryString["formname"].ToString()!=dbNull.ToString())
{
string formvalue = Request.QueryString["formname"].ToString();
}
Mahesh ChandRank #1 · 393.3K reputationPosted Oct 8, 2010, 9:55 AM EDT
if (Request.QueryString["formname"] != null)
{
}
Vikas AhlawatRank #2,648 · 525 reputationPosted Oct 14, 2010, 3:15 AM EDT
My problem is solved by this
http://dotnetslackers.com/Events/re-23154_Capture_Master_Page_Events_in_Content_Pages_ASP_NET_2_0.aspx
article
but it is very difficult
Which solution you give me it never
if (Request.QueryString["formname"] != null)
{
} never true
you can also read this article.
if any other easy solution then please explain.
Thanks any way
i m marking it answer.
Suthish NairRank #92 · 22.8K reputationPosted Oct 14, 2010, 6:03 AM EDT
http://www.c-sharpcorner.com/UploadFile/suthish_nair/3781/Default.aspx?ArticleID=8d6a6498-9ead-481b-997f-3d264369d509
but theres some security issues.
Vikas AhlawatRank #2,648 · 525 reputationPosted Oct 14, 2010, 8:08 PM EDT