Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a repeater which shows the list of categories ( which i have in database ) , i have another repeater inside this repeater which shows the items related to the category from my db, the category repeater works fine , but this is what i want to do :
category1=>item1_category1, item2_category1, item3_category1 , ....
category2=>item1_category2, item2_category2, item3_category2, ....
........
as i said , there is no problem in category list, but i dont know what should i do for the items list.
in a normal situation if i want to use a sql command i should use " select item from db where category=@category" but in this situation @category changes through the repeater( category repeater)
any idea ?!!!!!!!
thanks in advance
Posted

You want to use the onitemdatabound event to find the inner repeater in code. At that point, you can access the row that you're in, so store in that row the data you need to know the sub query, and then run the code to assign a data source.
 
Share this answer
 
Comments
Saeed Jafarian 19-Aug-12 12:25pm    
the real problem is how to assign the category items when "category" is not static, it changes through the repeater1
Christian Graus 19-Aug-12 13:01pm    
How is that an issue ? You run the SQL to get your data, at the level of a parent data item, so you can, at that point. work out exactly what the data is you're selecting
Hi Saeed,

There will be 2 Repeater. 1st for category and another for items.
Now Put Category Item Repeater into Category repeater`s item template and save the category id into Hidden field.
Now you can bound Category Item Repeater into the ItemDatabound event of main Category repeater.
Here you will find the category id of main Category Repater using find hidden field value method.and you can bind here your another repeater.

Thanks,
Viprat
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900