如何在asp.net中的数据列表中查找行 [英] How to find row inside datalist in asp.net

查看:100
本文介绍了如何在asp.net中的数据列表中查找行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一个数据列表.里面的数据列表我有表.内表我有tr
即默认情况下不显示的表格行.如何在下拉列表中找到该行,然后选择要更改的索引块和样式.

Hello All,
I have a data list. Inside data list i have table. Inside table i have tr
i.e.table row whose display is by default none. How to find that row at drop down select index change and style to be done block.

推荐答案

您需要迭代DataList 中的所有项目以找到并操纵它们.假设您要查找ID为ddlcountry的DropdownList,则可以使用下面的代码
You need to iterate all items in DataList to find the DropdownList and manipulate them. Say you want to find the DropdownList to which id is ddlcountry, then you can use the code below
foreach(DataListItem dlistItem in DataList1.Items)
{
   DropDownList ddlcountry=  dlistItem.item[i].
                findControl("ddlcountry") as DropDownList;
   if(ddlcountry!=null)
   {
     int id=Convert.ToInt32(ddlcountry.SelectedValue);
   }
}


希望这会有所帮助.


Hope this will help.


这篇关于如何在asp.net中的数据列表中查找行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆