dynamic dropdownlist in datagrid
-
i have three column s as dropdownlists in datagrid. i want to populate the second and third dd on the onseleection changed event of first dropdownlist of datagrid. hoe to implement this at the runtime. please help me out neo
Hi, Do the following, 1. Change autopostback to the first dd 2. On the First dd write in the aspx code 3. Write in the behind code Public Sub Dropdownlist1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) End Sub To access to the others dd you will need the item id and the column where those are located. You can do the following= I. In the Itemdatabound save the item index in the Dropdownlist1: ctype(me.datagrid.items(1).cells(ddColumn).findcontrol("Dropdownlist1"),dropdownlist).Attributes.add("itemindex",e.itemindex) II. In the Dropdownlist1_SelectedIndexChanged: ItIndex as integer = ctype(me.datagrid.items(1).cells(ddColumn).findcontrol("Dropdownlist1"),dropdownlist).Attributes("itemindex") ctype(me.datagrid.items(ItIndex ).cells(intddColumn).findcontrol("dd2"),dropdownlist).datasource = YourDataSource ctype(me.datagrid.items(ItIndex ).cells(intddColumn).findcontrol("dd2"),dropdownlist).databind Happy Programming emorales mcdba, mcad, mcsd
-
Hi, Do the following, 1. Change autopostback to the first dd 2. On the First dd write in the aspx code 3. Write in the behind code Public Sub Dropdownlist1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) End Sub To access to the others dd you will need the item id and the column where those are located. You can do the following= I. In the Itemdatabound save the item index in the Dropdownlist1: ctype(me.datagrid.items(1).cells(ddColumn).findcontrol("Dropdownlist1"),dropdownlist).Attributes.add("itemindex",e.itemindex) II. In the Dropdownlist1_SelectedIndexChanged: ItIndex as integer = ctype(me.datagrid.items(1).cells(ddColumn).findcontrol("Dropdownlist1"),dropdownlist).Attributes("itemindex") ctype(me.datagrid.items(ItIndex ).cells(intddColumn).findcontrol("dd2"),dropdownlist).datasource = YourDataSource ctype(me.datagrid.items(ItIndex ).cells(intddColumn).findcontrol("dd2"),dropdownlist).databind Happy Programming emorales mcdba, mcad, mcsd
-
Hi, I found an error in the example: I. In the Itemdatabound save the item index in the Dropdownlist1: ctype(me.datagrid.items(e.itemindex).cells(ddColumn).findcontrol("Dropdownlist1"),dropdownlist).Attributes.add("itemindex",e.itemindex) II. In the Dropdownlist1_SelectedIndexChanged: ItIndex as integer = ctype(sender,dropdownlist).Attributes("itemindex") ctype(me.datagrid.items(ItIndex ).cells(intddColumn1).findcontrol("dd2"),dropdownlist).datasource = YourDataSource ctype(me.datagrid.items(ItIndex ).cells(intddColumn2).findcontrol("dd2"),dropdownlist).databind You welcome! emorales mcdba, mcad, mcsd