是否有可能gridview按钮字段列可见false? [英] is it possible gridview button field column visible false?
本文介绍了是否有可能gridview按钮字段列可见false?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码,如果复选框条件满足,那么
this is my code if checkbox condition satisfied true so
<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按钮字段编辑按钮可见或启用false我该怎么办?谢谢我不想看到编辑按钮
gridview 6.column has button field edit button visible or enable false how can I do?thanks I dont want to see edit button
推荐答案
在RowDataBound事件中
In RowDataBound Event
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
按钮字段的属性可见。!!
Button field has attribute visible.!!
<asp:ButtonField ButtonType="Image" CommandName="Edit"
ImageUrl="~/images/icons/hammer_screwdriver.png" Text="Edit"
HeaderText="Düzelt" Visible="false" />
您可以使用RowDataBound事件来完成。
You can do it by using RowDataBound event.
这篇关于是否有可能gridview按钮字段列可见false?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文