Re: how to select a row in gridview in asp.net
- From: "Mark Rae [MVP]" <mark@xxxxxxxxxxxxxxxxx>
- Date: Wed, 1 Aug 2007 13:20:11 +0100
"Dinu" <visitdinu@xxxxxxxxx> wrote in message news:1185968631.540663.113560@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
how can we select a row in a gridview with out select column and get
events fired
<asp:GridView ID="MyGridView" runat="server" OnRowDataBound="MyGridView_RowDataBound" OnSelectedIndexChanged="MyGridView_SelectedIndexChanged">
....
....
....
</asp:GridView>
protected void MyGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(MyGridView, "Select$" + e.Row.RowIndex.ToString()));
e.Row.Style.Add("cursor", "pointer");
}
}
protected void MyGridView_SelectedIndexChanged(object sender, EventArgs e)
{
string strSelectedID = MyGridView.SelectedValue.ToString();
}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
.
- Follow-Ups:
- References:
- how to select a row in gridview in asp.net
- From: Dinu
- how to select a row in gridview in asp.net
- Prev by Date: Re: Ent Library Application blocks
- Next by Date: RE: Ent Library Application blocks
- Previous by thread: how to select a row in gridview in asp.net
- Next by thread: Re: how to select a row in gridview in asp.net
- Index(es):
Relevant Pages
|