Hello everyone,
I am running into a RadGrid and binding the datasource for it programmatically, one of the columns should be a dropdown list so when I am in edit mode it would query a table and show options to choose from
And here is the ItemDataBound that I can't seem to get to work;
It works fine to bind the checkbox but it is not working for the dropdownlist.
I saw in other forms about the gridColumnDropDownList but I couldn't find a way to bind it programmatically; any help will be appreciated.
Thanks,
Shehab
I am running into a RadGrid and binding the datasource for it programmatically, one of the columns should be a dropdown list so when I am in edit mode it would query a table and show options to choose from
| <radG:GridTemplateColumn DataField="DepName" HeaderText="DepName" UniqueName="DepName"> |
| <ItemTemplate> |
| <asp:DropDownList ID="lblDep" runat="server" Enabled="false" /> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <asp:DropDownList ID="DepNameddl" runat="server" /> |
| </EditItemTemplate> |
| </radG:GridTemplateColumn> |
| Protected Sub rgPersonAdmin_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.WebControls.GridItemEventArgs) Handles rgPersonAdmin.ItemDataBound |
| If TypeOf e.Item Is GridDataItem Then |
| Dim item As GridDataItem = DirectCast(e.Item, GridDataItem) |
| Dim strChk As String = item.GetDataKeyValue("PersonIndic").ToString() |
| Dim chkbx As CheckBox = DirectCast(item("PersonIndic").FindControl("cbPersonIndic"), CheckBox) |
| If strChk = "1" Then |
| chkbx.Checked = True |
| Else |
| chkbx.Checked = False |
| End If |
| 'dropdownlist |
| Dim ddl As DropDownList = DirectCast(item("DepName").FindControl("lblDep"), DropDownList) |
| Dim getDS As New DataSet |
| getDS = dataConn.PhoneGetDepDDL() |
| ddl.DataSource = getDS.Tables(0).DefaultView |
| ddl.DataTextField = "DepName" |
| ddl.DataValueField = "DepID" |
| ddl.DataBind() |
| End If |
| End Sub |
I saw in other forms about the gridColumnDropDownList but I couldn't find a way to bind it programmatically; any help will be appreciated.
Thanks,
Shehab