in vb i could use code like this to get the field name from a database table and then hide the textbox with the same name.
but in asp.net using vb.net i can figure it out. the code below gives the error "Compiler Error Message: BC30367: Class 'ASP.srpages_sr_aspx' cannot be indexed because it has no default property."
does anybody know a way to do this?
Code:
if rs("FieldName") = "hidden" then
me("txt" & rs("FieldName")).visible = false
end if
but in asp.net using vb.net i can figure it out. the code below gives the error "Compiler Error Message: BC30367: Class 'ASP.srpages_sr_aspx' cannot be indexed because it has no default property."
Code:
Dim MyDataReader As System.Data.SqlClient.SqlDataReader
Dim MyCommand As System.Data.SqlClient.SqlCommand
Dim MyConnection As System.Data.SqlClient.SqlConnection
MyConnection = New System.Data.SqlClient.SqlConnection("server=sfx02ra04; initial catalog=SFXServiceRequestDB;uid=username;pwd=password")
MyConnection.Open()
MyCommand = New System.Data.SqlClient.SqlCommand
MyCommand.Connection = MyConnection
MyCommand.CommandText = "SELECT StageScreenFields.FieldName, StageScreenFields.FieldType FROM StageScreenFields WHERE (((StageScreenFields.FieldType) Is Not Null) AND ((StageScreenFields.StageID)=" & vstageID & "));"
MyDataReader = MyCommand.ExecuteReader()
'MyDataReader.Read()
While MyDataReader.Read
if MyDataReader.Item("FieldType") = "Hidden" then
me("txt" & MyDataReader.Item("FieldName")).visible = false
end if
End While
MyDataReader = Nothing
MyCommand = Nothing
MyConnection.Close()
MyConnection = Nothing
does anybody know a way to do this?