i've been stuck on this problem all day.
how can i use a variable name to set several textboxes to readonly?
it gives the error:
'readonly' is not a member of 'System.Web.UI.Control'. on this line:
how can i use a variable name to set several textboxes to readonly?
Code:
While MyDataReader.Read
if MyDataReader.Item("FieldType") Is System.DBNull.Value then
' do nothing
else
if MyDataReader.Item("FieldType") = "Hidden" then
Page.FindControl("txt" + MyDataReader.Item("FieldName")).visible = false
Page.FindControl("lbl" + MyDataReader.Item("FieldName")).visible = false
end if
if MyDataReader.Item("FieldType") = "ReadOnly" then
Page.FindControl("txt" + MyDataReader.Item("FieldName")).readonly = true
'txtShortDesc.readonly = true
end if
End If
End While
'readonly' is not a member of 'System.Web.UI.Control'. on this line:
Code:
Page.FindControl("txt" + MyDataReader.Item("FieldName")).readonly = true