ASP.NET C# 用DataList控件中加子控件LinkButton,如何写链接呢?请指教,谢谢!
<asp:DataList ID="pldetails" runat="server" RepeatColumns="1" Height="23px"
Width="944px" onitemdatabound="pldetails_ItemDataBound">
<ItemTemplate>
<div class="pldetails2">
<div class="pltitle">
<div class="pltitleleft">作者:[<font color="red"><%#Eval("user_id") %></font>] 评论时间:<font color="green"><%#Eval("scdate") %> </font></div>
<div class="pltitleright">
<asp:LinkButton ID="LinkButton1" runat="server"
PostBackUrl='~/Editordel.aspx?id=<%#Eval("id")%>'>编辑</asp:LinkButton></div>
</div>
<div class="pldesc">
<div class="pluserpict"><img width="50" alt="" src='<%#Eval("user_pic") %>' /></div>
<div class="plcont"><p style="color:#5A5A5A; line-height:25px;"><%#Eval("message") %></p></div>
</div>
<hr style="border:1px dotted #ddd">
</div>
</ItemTemplate>
</asp:DataList>
上面是在DataList控件中,人为地加上一个子控件linkbutton, 想点击子控件响应弹出另一页的链接事件。
其中的:<asp:LinkButton ID="LinkButton1" runat="server"
PostBackUrl='~/Editordel.aspx?id=<%#Eval("id")%>'>编辑</asp:LinkButton></div>
点击老是不对!
请指教,谢谢!
------解决方案--------------------
HTML code
<asp:LinkButton runat="server" PostBackUrl='<%# GetUrl(Eval("id")) %>' Text="编辑"></asp:LinkButton>