C
CDWaddell
I'm using the following two segments of code on ASPX pages with Datalists.
The following segment of code produces the error "Object reference not set
to an instance of an object."
Label lblPhone = (Label)(e.Item.FindControl("lblPhone"));
if (lblPhone.Text.Length > 0)
lblPhone.Text = string.Format("{0
###)###-####}",
double.Parse(lblPhone.Text));
However, this segment of code works fine.
Label lblPhone = (Label)(e.Item.FindControl("lblClubPhone"));
if (lblPhone.Text.Length > 0)
lblPhone.Text = string.Format("{0
###)###-####}",
double.Parse(lblPhone.Text));
Different pages same code same Datalist settings, same label properties.
I've even copied the label id's from the html into the code to make sure I
was not missing something there.
Does anyone have any ideas???
The following segment of code produces the error "Object reference not set
to an instance of an object."
Label lblPhone = (Label)(e.Item.FindControl("lblPhone"));
if (lblPhone.Text.Length > 0)
lblPhone.Text = string.Format("{0

double.Parse(lblPhone.Text));
However, this segment of code works fine.
Label lblPhone = (Label)(e.Item.FindControl("lblClubPhone"));
if (lblPhone.Text.Length > 0)
lblPhone.Text = string.Format("{0

double.Parse(lblPhone.Text));
Different pages same code same Datalist settings, same label properties.
I've even copied the label id's from the html into the code to make sure I
was not missing something there.
Does anyone have any ideas???