Is there a way to select a row in a gridview with the mouse without adding a Select button to the row?
Bill
Yes,
Please read the article below which tells about selecting gridview row by clicking on it. You need to write javascript code to make your cells or textboxes in editable mode
http://dotnetspeaks.net/post/Selecting-GridView-Row-by-clicking-anywhere-on-the-row.aspx
you can also take help from the code below:
Check for row.RowState.HasFlag( DataControlRowState.Edit ).
protected override void Render( System.Web.UI.HtmlTextWriter writer )
{
foreach( GridViewRow row in gvwOrderItems.Rows )
{
if( row.RowType == DataControlRowType.DataRow &&
row.RowState.HasFlag( DataControlRowState.Edit ) == false )
{
// enable click on row to enter edit mode
row.Attributes["onclick"] =
ClientScript.GetPostBackClientHyperlink( gvwOrderItems, "Edit$" + row.DataItemIndex, true );
}
}
base.Render( writer );
}
沒有留言:
張貼留言