Friday 3 May 2013

Disable controls in GridView

Hi all,

after so long time this is my new beginning...!

Lets start..

you can disable controls of your GridView  by simply make control Disabled=true;
you can do this by other way...

suppose your gridview name is gvtest. On its 'onrowdatabound event you need to call below funtion.



 protected void gvtest_RowDataBound(object sender, GridViewRowEventArgs e)
        {
         
       
             if (e.Row.RowType == DataControlRowType.DataRow)
             {

           
               
                     e.Row.Cells[2].Attributes.Add("disabled", "disabled");
                     e.Row.Cells[3].Attributes.Add("disabled", "disabled");
     
                 }
           
               
               
            }