最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

如何取得Repeater控件選擇的項(xiàng)目及注意事項(xiàng)

 更新時(shí)間:2013年01月25日 10:15:16   作者:  
Repeater控件,每個(gè)item前有一個(gè)CheckBox,把選擇的item列顯出來(lái),有兩個(gè)地方需要注意的,就是CheckBox與Label,這個(gè)Label是隨你需要獲取的內(nèi)容而變化喔。如你想獲取Nickname,那你需要把綁定的的內(nèi)容放在Label上
Repeater控件,每個(gè)item前有一個(gè)CheckBox,把選擇的item列顯出來(lái)。

這個(gè)演法中,可以看到選擇之后,該行highlight,此功能可以參考這個(gè)鏈接:http://m.fzitv.net/article/33455.htm
下面是Repeater控件Html,有兩個(gè)地方需要注意的,就是CheckBox與Label,這個(gè)Label是隨你需要獲取的內(nèi)容而變化喔。如你想獲取Nickname,那你需要把綁定的的內(nèi)容放在Label上。
Repeater & CheckBox
復(fù)制代碼 代碼如下:

<asp:Repeater ID="RepeaterEmailList" runat="server">
<HeaderTemplate>
<table border="1" cellpadding="1" cellspacing="0" width="96.5%">
<tr>
<td>
&nbsp;
</td>
<td>
Nickname
</td>
<td>
Email
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="height:10px; line-height:10px;">
<td>
<!--下面這個(gè)CheckBox的ID,注意喔,因?yàn)楹笈_(tái)需要用到它-->
<asp:CheckBox ID="CheckBox1" runat="server" />
</td>
<td>
<%# Eval("nickname")%>
</td>
<td>
<!--下面這個(gè)Label的ID,注意喔,因?yàn)楹笈_(tái)需要用到它-->
<asp:Label ID="Label1" runat="server" Text=' <%# Eval("mail")%>'></asp:Label>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

下面Insus.NET將會(huì)寫(xiě)一個(gè)方法,也許你的專(zhuān)案不止一個(gè)地方使用到,在需要的地方直接調(diào)用即可。
GetCheckBoxSelectedValue
復(fù)制代碼 代碼如下:

private string GetCheckBoxSelectedValue(Repeater repeater, string checkBoxId,string labelId)
{
string tempValue = string.Empty;
foreach (RepeaterItem item in repeater.Items)
{
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
if (item.FindControl(checkBoxId) != null && item.FindControl(labelId) != null)
{
CheckBox cb = (CheckBox)item.FindControl(checkBoxId);
Label lbl = (Label)item.FindControl(labelId);
if (cb.Checked)
{
tempValue = tempValue + ";" + lbl.Text;
}
}
}
}
if (tempValue.Length > 0)
{
tempValue = tempValue.Substring(2);
}
return tempValue;
}

相關(guān)文章

最新評(píng)論

华亭县| 大渡口区| 福安市| 炎陵县| 东城区| 三穗县| 宾阳县| 宝丰县| 开阳县| 宁国市| 林周县| 安国市| 荣成市| 韩城市| 洪洞县| 罗山县| 志丹县| 永川市| 仙居县| 余庆县| 江华| 阿拉善左旗| 余干县| 泸西县| 高雄市| 石台县| 临湘市| 霍邱县| 芜湖市| 玉门市| 二手房| 正定县| 苍南县| 宜章县| 贺州市| 卫辉市| 祁门县| 平泉县| 丰镇市| 堆龙德庆县| 万山特区|