Click here to Skip to main content
16,021,115 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
Hello,

I am developing a project in c# in which i want the output some thing like this.


Category1
Subcategory1
Sub_Subcategory1 Sub_Subcategory2

Subcategory2
Sub_Subcategory1 Sub_Subcategory2


Category2
Category3

All this has to be populated from database by using dynamic checkboxlist,
when i select Sub_Subcategories it has to be entered into the database.
if i check Category1,Subcategory1 and Subcategory2 has to displayed, if I check Subcategory1, Sub_Subcategory1 and Sub_Subcategory2 has to be displayed.

Please help me.

since am using update panel am unable to use the treeview control. can any one help me to come out this asap.
Posted
Comments
Sandeep Mewara 22-Jun-12 5:02am    
Not sure what is your problem. Where are you stuck? What have you tried so far?

1 solution

there's not enough information...
assuming the SQL tables are:
Category
int id; (primary key)
varchar cat;

Subcategory
int subid;
int catid; (foreign key)
varchar subcat;

Assuming you have your SQLConnectionString:
You should have classes that get and set rows in the tables.
for Category you need SQL methods like
'select * from Category where id = ???'
for sub categories:
'select * from SubCategory where catid=???'

I don't know what you mean by 'dynamic checkbox'
but there should be an event like:
void CheckboxChanged or SelectedIndex

in this event handler
if(checkbox is checked) get category id or sub-categoryid
use Category class select, insert or update method
 
Share this answer
 
v2
Comments
shabadiveda 25-Jun-12 2:38am    
thnx for the reply,
dynamic checboxlist means, checkboxlist which wil populate from database at runtime. i tried ur answer but still am not getting desired output.
shabadiveda 27-Jun-12 7:24am    
thanx, i solved it by my self by using nested repeaters, with check box inside it.

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