问题描述
遇到一个问题,想点击listview中任意一行(linkbutton)时获取该行的<%#eval("id")%>传值到另外一个页面,但是通过controls和findcontrol只能遍历到所有的lable,无法得到对应的lable,请各位大大帮忙。<divid="sy_shiwuzhaoling"class="sy_div"><divclass="div_daohang_bccolor"><divstyle="float:left;width:160px;text-align:left;line-height:30px;">失物招领</div><divstyle="float:left;text-align:right;width:160px;line-height:30px;"><aclass="sy_a1"href="#">更多>>></a></div><divclass="float"></div></div><asp:ListViewID="ListView1"runat="server"DataSourceID="SqlDataSource1"ItemPlaceholderID="zhanweifu"onselectedindexchanged="ListView1_SelectedIndexChanged"onselectedindexchanging="ListView1_SelectedIndexChanging"><LayoutTemplate><table><trid="zhanweifu"runat="server"></tr></table></LayoutTemplate><ItemTemplate><trclass="sy_tr"><tdclass="sy_td"><asp:LinkButtonID="LinkButton2"runat="server"onclick="LinkButton2_Click"><divclass="td_div"><%#Eval("biaoti")%></div><divclass="td_div_right"><%#Eval("shiwushijian")%></div><asp:LablleID="lable1"runat="server"Text='<%#Eval("ID")%>'/></asp:Lable></asp:LinkButton></td></tr></ItemTemplate></asp:ListView><asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ConnectionStrings:shiwuzhaolingConnectionString%>"SelectCommand="SELECTtop10[biaoti],[shiwushijian],[ID]FROM[shiwuzhaoling]"></asp:SqlDataSource>
解决方案
解决方案二:
“通过Controls”?遍历?不需要啊!谁知道你是怎么写的代码呢?