其他数据列表中的数据列表 [英] Datalist inside other datalist
问题描述
你好,我的要求是
数据库2个表
--------------------
1)catagory(catid,category_name)
2)subcatagory(subid,subcategory_name,catid)
我里面有两个达塔尔人.
datalist1将显示类别名称.要显示类别名称,我已使用链接按钮
单击第二个数据列表时,在选择索引更改时,每个链接按钮将显示子类别
我的代码是
---------------------
Hello my requirement is that
database 2 tables
--------------------
1)catagory(catid,category_name)
2)subcatagory(subid,subcategory_name,catid)
i have two dtalist one inside other.
datalist1 will dispaly catagoryname .To display catagoryname i have taken link button
the 2nd datalist will show subctagory on click of each linkbutton on seleted index change
my code is
---------------------
DataListItem item = DataList1.SelectedItem;
foreach (DataListItem ctitem in DataList1.Items)
{
ctitem.FindControl("DataList2").Visible = false;
}
SqlDataSource2.SelectParameters[0].DefaultValue = DataList1.DataKeyField[0].ToString();
DataList1.SelectedItem.FindControl("DataList2").Visible = true;
--------------------------------
问题是,每次我单击链接按钮时刷新,它就不会出现在此循环内
谁能帮我解决这个问题
--------------------------------
problem is that its not coming inside this loop every time i click on link button the refresh take place
Can anyone help me about this
推荐答案
我认为您可以使用更新面板来实现.
否则您需要将selectedindex值或DataList1.selectedindex存储在视图状态或隐藏变量中
if(viewstate ["SelectedIndex"]!= null)
{
在此处重建数据列表1和2
}
谢谢
购买蕾丝
Hi,
I think you can achieve this using an update panel.
or else you need store the selectedindex value or the DataList1.selectedindex in a viewstate or a hidden variable
if(viewstate["SelectedIndex"] != null)
{
rebuild the datalist 1 and 2 here
}
Thanks
Buy Lace
这篇关于其他数据列表中的数据列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!