我的网格视图中有一个名为 StopImageButton 和 StartImageButton 的图像按钮
<asp:TemplateField HeaderText="Stop">
<ItemTemplate>
<asp:ImageButton ID="StopImageButton" runat="server" OnClick="StopImageButton_Click"
ImageUrl="~/Stop.jpg" Width="25" Height="25" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Start" Visible="true">
<ItemTemplate>
<asp:ImageButton ID="StartImageButton" runat="server" OnClick="StartImageButton_Click"
ImageUrl="~/Start.jpg" Width="25" Height="25" />
</ItemTemplate>
</asp:TemplateField>
我也有隐藏StopImageButton
页面加载时间的代码
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
ImageButton ImgBtn = e.Row.FindControl("StopImageButton") as ImageButton;
ImgBtn.Visible = false;
}
}
protected void StopImageButton_Click(object sender, ImageClickEventArgs e)
{
}
protected void StartImageButton_Click(object sender, ImageClickEventArgs e)
{
}
我想要做的是,单击 后StartImageButton
,它将被隐藏, StopImageButton
然后现在将可见?帮助!