关于Repeater的回发问题!
大家好,问题是这样:
在页面上有个Repeater,代码如下:
<asp:Repeater ID="rep" runat="server" OnItemCommand="rep_ItemCommand"> <ItemTemplate> <tr> <td><%#DataBinder.Eval(Container.DataItem,"Id") %></td> <td><%#DataBinder.Eval(Container.DataItem,"Name") %></td> <td> <asp:LinkButton ID="lbtn" runat="server" CommandName="del" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"Id") %>'>删除</asp:LinkButton> </td> </tr> </ItemTemplate> </asp:Repeater>
var theForm = document.forms['form1'];if (!theForm) { theForm = document.form1;}function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); }}//]]></script> <div> <table> <tr> <td>0</td> <td>Name0</td> <td> <a id="rep_ctl00_lbtn" href="javascript:__doPostBack('rep$ctl00$lbtn','')">删除</a> </td> </tr>......
public class MyView : System.Web.UI.Control, System.Web.UI.IPostBackEventHandler public void RaisePostBackEvent(string eventArgument) { this.Initialize(); string[] parts = eventArgument.Split('='); string commandName = parts[0]; string value = (parts.Length > 1 ? parts[1] : null); switch (commandName .ToLower()) { case "Command1": .......
[解决办法]
http://hi.baidu.com/trip008/blog/item/85c49b19c633954042a9adea.html 查了一下 也学习了一下 感觉 不是很懂 呵呵
[解决办法]
repeater没有实现这个接口,但你的代码中
使用了asp:LinkButton这个模板,linkbutton继承了IPostBackEventHandler
[解决办法]