I have two controls a TextBox and a radcombobox
in ItemTemplate of a GridView. What I want to do is when the event onclientsideselectedindexchanges
of radcombobox
is fired. I want to show/Hide the TextBox on client side with JavaScript.
Basic purpose of this is to avoid post back to show the TextBox which will be DataBound to database.
If it is not possible to do on the client-side, then please suggest some alternative on server side.
In my example, I have a GridView with a template field and it contains a DropDown menu and a TextBox. The
OnLoad
event in JavaScript sets the display style of the TextBox to"none"
. Set theOnChange
event of the DropDown inOnRowDataBound
event of the GridView and call the JavaScript function where you set the TextBox display style to what you require.In my example, I display the TextBox only when the DropDown selected index is
"1"
.I have done all this in my code-refer to this: Gridview
ID="GridView1"
: