T
tshad
Is there a way to get the text from control, without actually defining it?
For example, I have a DataGrid that has fields that are either Labels or
Textboxes, depending on whether they are in edit mode or not.
Dim answer as String
Dim lblAnswer as Label = CType(oDataGridItem.FindControl("Answer"),Label)
if lblAnswer = nothing then
Dim txtAnswer as TextBox =
CType(oDataGridItem.FindControl("Answer"),TextBox)
answer = txtAnswer.text
else
answer = lblAnswer.text
end if
' use answer for something
Is there a way to get the text from an object in a DataGridItem, without
having to set it to an object first?
Thanks,
Tom
For example, I have a DataGrid that has fields that are either Labels or
Textboxes, depending on whether they are in edit mode or not.
Dim answer as String
Dim lblAnswer as Label = CType(oDataGridItem.FindControl("Answer"),Label)
if lblAnswer = nothing then
Dim txtAnswer as TextBox =
CType(oDataGridItem.FindControl("Answer"),TextBox)
answer = txtAnswer.text
else
answer = lblAnswer.text
end if
' use answer for something
Is there a way to get the text from an object in a DataGridItem, without
having to set it to an object first?
Thanks,
Tom