用户操作
[即时聊天] [发私信] [加为好友]
爱你网ID:goody9807
142426次访问,排名561好友217人,关注者0
http://www.cnblogs.com/goody9807
http://www.51ini.com
goody9807的文章
原创 93 篇
翻译 0 篇
转载 139 篇
评论 86 篇
爱你网的公告








一个不错的P2P软件,里面肯定有你要的资源

我的爱你网,讨论.Net


最近评论
hhshang:楼主你做过这个打字程序,如果做了,可不可以发一份给我学习一下呀,我的邮箱是:zeng_xianchun@126.com
yw2008wy:写得不错,我还没有试试,不过挺感谢帖出来
zq32206124:英文看不懂啊
zq32206124:英文看不懂啊
jing_cai:谢谢你的无私奉献!
文章分类
收藏
相册
Csdn专用
个人专用
XML相关资料
XML Server与XML-enabled Web Server介绍
xmlhttp发送 xml 例子详解
在Asp.net里显示XML格式内容.
树的资料
asp.net中的treeview 怎么用
数据库连接
CSDN数据库连接大全
DSN方式连接数据库
杂类
100分问一个突然出现的Cookie问题,关于添加/删除Cookie的。
c#存取图片 (RSS)
我的主页(RSS)
高效.TEXTBLOG技巧终结篇
存档
软件项目交易
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
订阅到BlogLines
订阅到Yahoo
订阅到GouGou
订阅到飞鸽
订阅到Rojo
订阅到newsgator
订阅到netvibes

转载 关于repeater内控件的事件绑定,内部模板列 收藏

新一篇: 多站点整合—单点登录简单方案  | 旧一篇: 捕获window.close()事件写自己的方法

比较常规的方法是   使用Repeat(DataGrid,DataList,GridView均一样)   的   ItemCommand   事件,如  //   .aspx    <asp:Repeater   ID= "Repeater1 "   runat= "server "   OnItemCommand= "Repeater1_ItemCommand ">                          <ItemTemplate>                                  <asp:Button   ID= "btn "   CommandName= "SayHello "   runat= "server "   Text= "SayHello "   />                          </ItemTemplate>  </asp:Repeater>  //   .aspx.cs          protected   void   Repeater1_ItemCommand(object   source,   RepeaterCommandEventArgs   e)          {                  switch   (e.CommandName)   {                          case   "SayHello ":                                  Response.Write(e.Item.ItemIndex);                                  Response.Write(e.CommandArgument);   //   自定义的参数信息                                  break;                                          }          }  3.  直接设置   button   的   click   事件,   当然处理程序需要一点技巧才能获取其他信息,   如:  //   .aspx    <asp:Repeater   ID= "Repeater2 "   runat= "server "   OnItemCommand= "Repeater1_ItemCommand ">                          <ItemTemplate>                                  <asp:Button   ID= "btn "   runat= "server "   CommandArgument= ' <%#   Eval( "SomeFieldName ")   %> '   Text= "SayHello "   OnClick= "btnInRepeat2_Click "   />                                  <input   id= "btn2 "   runat= "server "   runat= "server "   value= "SayHello "   onclick= "btn2InRepeat2_Click "   />                          </ItemTemplate>                  </asp:Repeater>  //   .aspx.cs    protected   void   btnInRepeat2_Click(object   sender,   EventArgs   e)          {                  //   触发事件的   Button                  Button   btn   =   sender   as   Button;                  //   Button   所在行                  RepeaterItem   item   =   btn.NamingContainer   as   RepeaterItem;                          }          protected   void   btn2InRepeat2_Click(object   sender,   EventArgs   e)          {                  //   触发事件的   Button                  HtmlButton   btn   =   sender   as   HtmlButton;                  //   Button   所在行                  RepeaterItem   item   =   btn.NamingContainer   as   RepeaterItem;          }  4.    对于   button   ,建议使用   WebControl   的   Button   而不是使用   runat=serer   的   input,  你看到了   button   具有   CommandName   和   CommandArguments   可以使用  Hope   helpful!
1.   不推荐使用Html   Web   Controls 2.   如果在Repeater中ItemTemplate中放的按钮,一般使用ItemCommand事件处理即可,无需自己再注册事件

发表于 @ 2008年07月04日 10:28:20|评论(loading...)|收藏

新一篇: 多站点整合—单点登录简单方案  | 旧一篇: 捕获window.close()事件写自己的方法

评论:没有评论。

发表评论  


当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
Csdn Blog version 3.1a
Copyright © 爱你网