首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

repeater中button的用法,该怎么处理

2012-04-19 
repeater中button的用法我在repeater中放了一个button,我想实现在点某条记录前的button的同时让这个button

repeater中button的用法
我在repeater中放了一个button,我想实现在点某条记录前的button的同时让这个button的text='选中'。请问这个如何实现。
还有各位大侠有没有repeater中使用其他各种控件的实例或文章,能整合在一起的最好了。3Q。

[解决办法]
repeater
[解决办法]
<input type="button" onclick="this.value='选中'" value="点我"/> 不晓得对否?
[解决办法]

探讨

<input type="button" onclick="this.value='选中'" value="点我"/> 不晓得对否?

[解决办法]
C# code
<asp:Repeater ID="rpt" runat="server">   <ItemTemplate>           <asp:Button ID="btn" runat="server" Text="按钮" OnCommand="btn_Command"/>   </ItemTemplate></asp:Repeater>后台cs文件public void btn_Command(object sender,CommandEventArgs e){    Button btn = sender as Button;    btn.Text = "选中";}
[解决办法]
C# code
protected void Repeater1_ItemCommand(object sender, RepeaterItemEventArgs e){  if(e.commandName=="button1")     {      button bt= e.Item.FindControl("button1") as Button;    if(bt.text=="选中")         {                  bt.text="未选中";    }    else    { bt.text="选中";   }}
[解决办法]
HTML code
<asp:Button ID="btn" runat="server" Text="点我" onclick="if(this.value=='选中')this.value='未选中';else{this.value='选中';}"/> 

热点排行