获取Repeater中的id(Repeater.ItemCommand 事件的使用)

<asp:Repeater ID="rp2" runat="server" OnItemCommand="rp2_ItemCommand">

<ItemTemplate>
<table width="100%" cellpadding="0" cellspacing="0" border="1">
<tr>
<td>id:<%#Eval( "id" )%></td>
<td>姓名:<%#Eval( "StudentName" )%></td>
<td>选题题目:<%#Eval( "XuantiTitle" )%></td>
<td>完成方式:<%#Eval( "wcfs" )%></td>
<td>添加时间:<%#Eval( "AddTime" )%></td>
<td>审核情况:<%#Eval( "ShenHe" )%></td>
<td>备注:<%#Eval( "YuanYin" )%></td>
<td><asp:linkbutton id="UploadKTBG" runat="server" commandname="LinkButton1" CommandArgument='<%#Eval("id") %>' text="上传开题报告" /></td>


</tr>
</table>

</ItemTemplate>

</asp:Repeater>

 

    protected void rp2_ItemCommand( object source, RepeaterCommandEventArgs e )
{
//Response.Write( "CommandName: " + e.CommandName );
Response.Write( "CommandArgument: " + e.CommandArgument.ToString() );

//LinkButton lb2 = e.Item.FindControl( "UploadKTBG" ) as LinkButton;
//Response.Write( "<br/>lb2.CommandArgument: " + lb2.CommandArgument.ToString() );

}

 

 

相关参考:

http://www.cnblogs.com/Jinglecat/archive/2006/05/12/398335.html

http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.repeater.itemcommand.aspx#Y541

http://bbs.bccn.net/thread-221878-1-1.html

 http://www.cnblogs.com/ilove35/archive/2011/09/01/2161613.html  (asp.net Repeater使用总结(序号列,主键ID,分页,空数据显示表头)

 

posted @ 2012-01-03 16:58  ishibin  阅读(1025)  评论(0编辑  收藏  举报