Master Page problem
-
I have written the following code. on Label1.Text error is coming i.e,"Object reference not set to an instance of an object." Calendar mpcalender = (Calendar)Page.Master.FindControl("Calendar1"); dat = mpcalender.SelectedDate.Date.ToString(); Label1.Text = dat.ToString(); Session["seldate"] = dat; Calender control is on the masterpage and Label control is on th ContentPlaceHolder. Plz help.
-
I have written the following code. on Label1.Text error is coming i.e,"Object reference not set to an instance of an object." Calendar mpcalender = (Calendar)Page.Master.FindControl("Calendar1"); dat = mpcalender.SelectedDate.Date.ToString(); Label1.Text = dat.ToString(); Session["seldate"] = dat; Calender control is on the masterpage and Label control is on th ContentPlaceHolder. Plz help.
is label in the master page
If You win You need not Explain............ But If You Loose You Should not be there to Explain......
-
I have written the following code. on Label1.Text error is coming i.e,"Object reference not set to an instance of an object." Calendar mpcalender = (Calendar)Page.Master.FindControl("Calendar1"); dat = mpcalender.SelectedDate.Date.ToString(); Label1.Text = dat.ToString(); Session["seldate"] = dat; Calender control is on the masterpage and Label control is on th ContentPlaceHolder. Plz help.
Please confirm whether your Lable control is on child page or on master page...
Amit Agarwal