Sunday, September 30, 2012

Code Snippet

to select a ASP.Net Grid Row by click

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if(e.Row.RowType == DataControlRowType.DataRow )
                    e.Row.Attributes.Add(
                        "onclick",
                        Page.ClientScript.GetPostBackEventReference(sender as Control, @"Select$" + e.Row.RowIndex.ToString())
                        ) ;
...

No comments:

Post a Comment