ksfok
asked on
Gridview Row textbox.Attributes.Add("onblur",
Given the below code in an gridview RowCreated event:
if (e.Row.RowType == DataControlRowType.DataRow )
{
TextBox textbox =
(TextBox)e.Row.Cells[3].Fi ndControl( "txtPatien t");
textbox.Attributes.Add("on blur",
"alert('OnBlur!');");
}
How can "alert('OnBlur!' above be replaced by javascript focus() of (TextBox)e.Row.Cells[4].Fi ndControl( "txtBox2") ? How can txtBox2 be invoked in javascript?
Thanks.
if (e.Row.RowType == DataControlRowType.DataRow
{
TextBox textbox =
(TextBox)e.Row.Cells[3].Fi
textbox.Attributes.Add("on
"alert('OnBlur!');");
}
How can "alert('OnBlur!' above be replaced by javascript focus() of (TextBox)e.Row.Cells[4].Fi
Thanks.
More clean code (group by parentheses)
textbox.Attributes.Add("on blur", "document.getElementById(' txtBox'+(t his.id.sub string(6)+ 1)).focus( )");
textbox.Attributes.Add("on
ASKER
Please remember here we are not dealing with a plain web page. Our commotion is taking place in a row of textboxes in a gridview's Row Created event. Please help. Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If textbox's id are ordered as txtBox1, txtBox2, .. , txtBoxN
then
textbox.Attributes.Add("on