我在DataList里放了一个LinkButton 控件 怎样给LinkButton 传参呀 后台又怎样接受LinkButton 传过来的参数
解决方案 »
- 关于timer控件使用!!
- select @@identity 老是返回0
- 求URLRewriter 正则表达式
- 运行ASP.NET 的 locahost 问题
- 如何在WebPartZone里显示谓词菜单(Verb菜单)?
- 请教各位高手:如何判断表单文本框中输入的数据为数字,且允许输入负数。
- Response.BinaryWrite 的问题
- 请问:ASP。NET(C#)中,CRYSTAL REPORT9.2的WEB打印按钮为什么不能直接打印,一按的话,就是导出为PDF?谢谢
- 菜问题 --有关事件.
- 可否写一个vb.net链接SQL数据库的例子来看看:)
- 怎么取消Visual Studio 2005 html控件table的宽度style定义
- iis5.1 下如何配置 能使 本机服务器 能够重定向?
传参protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "edit")
{
((Label)this.Repeater1.Items[0].FindControl("lblContent")).Visible = false;
((TextBox)this.Repeater1.Items[0].FindControl("txtTitle")).Visible = true;
((TextBox)this.Repeater1.Items[0].FindControl("txtContent")).Visible = true;
((Button)this.Repeater1.Items[0].FindControl("btnOK")).Visible = true;
((Button)this.Repeater1.Items[0].FindControl("btnCancel")).Visible = true;
}
else if(e.CommandName == "delete")
{
if (bbsManager.BBSDelete(Convert.ToInt32(e.CommandArgument.ToString())) > 0)
{
Alert.alert("删除成功!");
SourceBind();
}
else
{
Alert.alert("删除失败!");
}
}
}
接收参数
把 Repeater 换成 DataList 就Ok了 相信 LZ 能看懂
e.CommandArgument.ToString()
LinkButton 要在 DataList 控件里
要给LinkButton 设置 CommandArgument='<%#Eval("bbs_id") %>' 属性
GET传
我以前也有这样的问题
public int myint
{
get
{
return myvalues;
}
set
{
myvalues = value;
}
///////////////////属性 建在用户控件里
然后在你想要的位置调这个用户控件就行了 <ccl:nmae ID="name1" runat="server" myint='<%#Eval("") %>'/>
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click" CommandArgument=' <%# Eval("id")%>' CommandName="ck" />查看 </asp:LinkButton> </asp:LinkButton> </ItemTemplate>
((LinkButton)sender).CommandArgument.ToString()这样取值