Wednesday, December 22, 2010

Gridview add empty row with tab

Gridview add empty row with tab

The last column of the grid is a textbox called "txtbox"

In the code behind:

ItemDataBound event write

TextBox txtDescription = (TextBox)e.Row.FindControl("txtDescription");

txtDescription.Attributes.Add("onkeydown", "javascript:KeyPress(event, " + e.Row.Parent.ClientID + ((int)(e.Row.RowIndex + 1)).ToString() + ");");


then in the html write the following javascrit:


function KeyPress(event, btn)

{

if(event.keyCode==9 && !event.shiftKey)

{

btn.style.visibility = 'visible';

}

}


No comments:

Post a Comment