datalist中获取值的方法
aspx文件:
<asp:DataList ID= "dlTopSpeak " runat= "server " OnItemCommand= "dlTopSpeak_ItemCommand ">
<ItemTemplate>
<table border= "0 " cellpadding= "0 " cellspacing= "0 " width= "190px ">
<tr>
<td>
<asp:LinkButton ID= "lbtntitle " runat= "server " CommandName= "title " CommandArgument= ' <%#Eval( "SSpeakID ") %> '> <%#Eval( "speaktitle ") %> </asp:LinkButton>
<asp:Label ID= "labUserID " runat= "server " Visible= "false "> <%#Eval( "SUserID ") %> </asp:Label>
</td>
<td>
<asp:LinkButton ID= "lbtnUsername " runat= "server " CommandName= "name " CommandArgument= ' <%#Eval( "SUserID ") %> '> <%#Eval( "username ") %> </asp:LinkButton>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
cs文件:
protected void dlTopSpeak_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "title ")
{
//string ID = ((Label)e.Item.FindControl( "labUserID ")).Text;
Response.Redirect( "speak.aspx?speakID= " + e.CommandArgument.ToString() + "&userID= " + ID);
}
else if (e.CommandName == "name ")
{