Disable Textbox based on the value from Dropdownlist
Hi
I have a gridview control. On it I have a textboxe and dropdownlist
When ever I select the value from the dropdownlist, based on the selected value, I should disable the textbox so that user will not enter any text into it.
How can I do it??
I tried under gridview_selectedIndexchanged, and I am able to retrieve the value from the dropdownlist.. only when i tried to disable textbox it is throwing error, "Object reference not set to an instance of an object."
My code is as follows:
Public Sub GridView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged
Dim setup As DropDownList = CType(sender, DropDownList)
Dim row As GridViewRow = GridView1.Rows(GridView1.SelectedValue)
'Response.Write(setup.SelectedValue)
If setup.SelectedValue = "7" Then
Dim tx As TextBox = CType(GridView1.Controls(0).FindControl ("lookupvalue"), TextBox)
tx.Enabled = False
Else
'txt.Enabled = True
' txt.Text = "Not Free text"
End If
End Sub
Can anybody pls help me out!! Its very very urgent..
Bookmarks