I have a radmenu with sqldatasource.What I wanna is to get child items value and save to database.I used the code below,but this gets only value of parent items.How can I get the value of child items?
RadMenu getMenu = Master.FindControl("RadMenu1") as RadMenu;
getMenu.Items[i].Value;4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 19 Dec 2011, 11:03 AM
Hello,
Try the following code snippet to get the value of child items.
CS:
Thanks,
Princy.
Try the following code snippet to get the value of child items.
CS:
int i; for(i=0;i<RadMenu1.SelectedItem.Items.Count;i++) { string val= RadMenu1.FindItemByValue("2").Items[i].Value; //store the value of val in DB. }Thanks,
Princy.
0
Emre
Top achievements
Rank 1
answered on 19 Dec 2011, 12:10 PM
hello Princy,
I tried your code snippet but I get the error below.Also I wanna get the all of the value of child items,not selected ones.Index was out of range. Must be non-negative and less than the size of the collection.
I tried your code snippet but I get the error below.Also I wanna get the all of the value of child items,not selected ones.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
0
Princy
Top achievements
Rank 2
answered on 19 Dec 2011, 12:57 PM
Hello,
Try the following code snippet.
CS:
Thanks,
Princy.
Try the following code snippet.
CS:
protected void btn11_Click(object sender, EventArgs e) { foreach (RadMenuItem itm in RadMenu2.Items) { string s= itm.Value; //parent items if (itm.Items.Count > 0) { for (int i = 0; i < itm.Items.Count; i++) { string t = itm.Items[i].Value; //child items } } }}Thanks,
Princy.
0
Emre
Top achievements
Rank 1
answered on 19 Dec 2011, 01:06 PM
huge thanks,you saved my hours.It works perfect !