经验杂碎[自己能读懂的]
gridview中的操作
<asp:TemplateField HeaderText="首页显示">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Enabled="False" Checked ='<%# Bind("IsPublic") %>'/>
<asp:LinkButton ID="btnActiveExhibition" runat="server" CommandArgument='<%# Bind("Id") %>' CommandName ="activeExhibition" Enabled = '<%#!Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "IsPublic")) %>' >允许</asp:LinkButton>
<asp:Label ID="Label2" runat="server" Text="/"></asp:Label>
<asp:LinkButton ID="btnInactiveExhibition" runat="server" CommandArgument='<%# Bind("Id") %>' CommandName ="LockExhibition" Enabled ='<%# Bind("IsPublic") %>' >禁止</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
后台操作:
protected void GridViewExhibtion_RowCommand(object sender, GridViewCommandEventArgs e)
{
int m_id;
m_id = Convert.ToInt32(e.CommandArgument.ToString());
using (CExhibitionManager exbmgr = new CExhibitionManager())
{
switch (e.CommandName)
{
case "activeExhibition":
/// <summary>
/// 返回一个弹出窗口
/// </summary>
public static string Show(string strMsg)
{
return String.Format("<script language={1}javascript{1}>alert({1}{0}{1});</script>",strMsg,"\"");
}
<asp:TemplateField HeaderText="首页显示">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Enabled="False" Checked ='<%# Bind("IsPublic") %>'/>
<asp:LinkButton ID="btnActiveExhibition" runat="server" CommandArgument='<%# Bind("Id") %>' CommandName ="activeExhibition" Enabled = '<%#!Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "IsPublic")) %>' >允许</asp:LinkButton>
<asp:Label ID="Label2" runat="server" Text="/"></asp:Label>
<asp:LinkButton ID="btnInactiveExhibition" runat="server" CommandArgument='<%# Bind("Id") %>' CommandName ="LockExhibition" Enabled ='<%# Bind("IsPublic") %>' >禁止</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
后台操作:
protected void GridViewExhibtion_RowCommand(object sender, GridViewCommandEventArgs e)
{
int m_id;
m_id = Convert.ToInt32(e.CommandArgument.ToString());
using (CExhibitionManager exbmgr = new CExhibitionManager())
{
switch (e.CommandName)
{
case "activeExhibition":
/// <summary>
/// 返回一个弹出窗口
/// </summary>
public static string Show(string strMsg)
{
return String.Format("<script language={1}javascript{1}>alert({1}{0}{1});</script>",strMsg,"\"");
}
作者:灯火阑珊
出处:http://www.cnblogs.com/edidu/
关于作者:重庆IT老鸟一只
本文版权归作者所有,发布于博客园,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接
如有问题,可以通过