关闭

LinkButoon、ImageButton 几种绑定和传参方式

标签: LinkButton Imagebutt
238人阅读 评论(0) 收藏 举报
一、LinkButton的使用方法

1.linkbutoon的postbackurl带参传递方式

PostBackUrl="OrderWork.aspx?id=<%#Eval('OrderID') %>">

改成

PostBackUrl='<%#"OrderWork.aspx?id="+Eval('OrderID') %>'>

多个参数:

<asp:LinkButton ID="LinkButton1" PostBackUrl='<%#"OrderWork.aspx?id="+Eval("price")+"&name="+Eval("worth") %>' runat="server">LinkButton</asp:LinkButton>

 
后台:
 lbtnEditSubject.OnClientClick = "openWindowEdit('/ss/test.aspx?ID=" + Id + "&&name=" + name+  "',750,300)";

2.ImageButton
  <asp:ImageButton ID="ibtn_update" Style="vertical-align: middle;" CommandArgument='<%# Eval("Id") %>' ToolTip="修改" ImageUrl="../../images/Icons/22/i_22_update_normal.png" OnClick="ibtn_update_Click1" runat="server" />

其中ToolTip的属性是鼠标悬浮在上面出现文字

后台:
 protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            ListItemType lit = e.Item.ItemType;
            if (lit == ListItemType.AlternatingItem || lit == ListItemType.Item)
            {
                ImageButton ibtn_update = (ImageButton)e.Item.FindControl("ibtn_update");
                if (userFunction.UUpdate == false)//修改权限的验证
                {
                    ibtn_update.ImageUrl = "../../images/Icons/22/i_22_update_disable.png";
                    ibtn_update.Enabled = false;
                }
                ImageButton ibtn_delete = (ImageButton)e.Item.FindControl("ibtn_delete");
                if (userFunction.UDel == false)//删除权限的验证
                {
                    ibtn_delete.ImageUrl = "../../images/Icons/22/i_22_delete_disable.png";
                    ibtn_delete.Enabled = false;
                }
                //LinkButton lbtn_See = (LinkButton)e.Item.FindControl("lbtn_See");
                //if (userFunction.UQuery == false)//查看权限的验证
                //{
                //    lbtn_See.Enabled = false;
                //}
            }
        }
其中用了repter标签

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:502次
    • 积分:16
    • 等级:
    • 排名:千里之外
    • 原创:1篇
    • 转载:1篇
    • 译文:0篇
    • 评论:0条
    文章分类
    文章存档