Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my code if checkbox condition satisfied true so
XML
<asp:TemplateField HeaderText="İşlem Gördü">
                            <ItemTemplate>
                               <asp:CheckBox ID="CheckBox4" runat="server" Checked='<%# Eval("satisfied").ToString() == "1" ? true : false %>' />
                            </ItemTemplate>
                            <ItemStyle Width="20px" />
                        </asp:TemplateField>
                        <asp:ButtonField ButtonType="Image" CommandName="Edit"
                            ImageUrl="~/images/icons/hammer_screwdriver.png" Text="Edit"
                            HeaderText="Düzelt" />


gridview 6.column has button field edit button visible or enable false how can I do?thanks I dont want to see edit button
Posted
Comments
sainadh.chintha 21-Mar-13 7:22am    
There is an direct option (visible) for buttonfield.
Where do you want to do it, Code behind or javaScript ?
In which event ?
Member-2338430 21-Mar-13 8:12am    
code behind or javascript doesnt matter

In RowDataBound Event

C#
protected void grd_RowDataBound(object sender, GridViewRowEventArgs e)
{
   if (e.Row.RowType == DataControlRowType.DataRow)
   {
       CheckBox chk = (CheckBox)e.Row.FindControl("checkboxId");
       Button btn = (Button)e.Row.FindControl("yourid");  //u will get id
       if(chk.checked == true)
       {
           btnField.Enabled = false;
           //your code here.
       }
   }
}


Thanks
 
Share this answer
 
v2
Button field has attribute visible.!!

XML
<asp:ButtonField ButtonType="Image" CommandName="Edit"
                            ImageUrl="~/images/icons/hammer_screwdriver.png" Text="Edit"
                            HeaderText="Düzelt" Visible="false" />
 
Share this answer
 
v2
You can do it by using RowDataBound event.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900