1
Reply

Dynamically Disable row selection in GridView

Herald Suva

Herald Suva

Nov 29 2010 10:33 PM
9.5k
Hi,

I am new to C# and seeking for the assistance.

Problem is,

I have an Add, Edit, Delete button and a gridview. What i want is when I click the Add button I should not able to select row in gridview. Gridview should look like disabled.

Here is  my codes in gridview row created event.

  if (e.Row.RowType == DataControlRowType.DataRow)
                {
                        //e.Row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.textDecoration='underline';";
                        //e.Row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
                        e.Row.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference((Control)sender, "Select$" + e.Row.RowIndex.ToString()));
                      
                }

thanks,

Answers (1)