Object reference not set to an instance of an object.
hello iam getting this Error Just created the controls as an null and how to create the object for reference
1) as my analysis i got the information that i need to create the object reference with new keyword but how to do it script using c#
</script>
hello iam getting this Error Just created the controls as an null and how to create the object for reference
1) as my analysis i got the information that i need to create the object reference with new keyword but how to do it script using c#
Code:
public TextBox txtEventDate = null;
public Calendar calEventDate = null;
public Label lblResult = null;
protected void calEventDate_SelectionChanged (Object sender,EventArgs e)
{
this.txtEventDate = this.FindControl("txtEventDate") as TextBox;
this.calEventDate = this.FindControl("calEventDate") as Calendar;
txtEventDate.Text = calEventDate.SelectedDate.ToString ("d");
}
protected void btnSubmit_Click(Object Sender,EventArgs e)
{
this.lblResult = this.FindControl("lblResult") as Label;
lblResult.Text = "You Picked" + txtEventDate.Text;
}
Comment