Hi,
How can I populate a ‘dropDownList’ inside a radGrid from the code behind?
The custom form template is as follows:
<FormTemplate> |
<asp:Label ID = "lblContact" runat ="server" text = "Contact"></asp:Label> |
<asp:DropDownList ID="ddlContacts" runat ="server" DataValueField ="Description" DataTextField ="description"/> <br/><br /> |
<asp:Button ID="btnSubmit" runat ="server" Text ="Submit" /> |
<asp:Button ID="btnCancel" runat ="server" Text ="Cancel" /> |
</FormTemplate> |
In the code behind I have the following:
Private
Sub RadGridService_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGridServices.NeedDataSource
Dim objContacts As Array |
'Gets data from web service |
objContacts = objReceptionBureauService.getAllContactsForEmployee("EmployeeID") |
Dim contacts As DropDownList = TryCast(FindControl("ddlContacts"), DropDownList) |
contacts.DataSource = objContacts |
contacts.DataBind() |
contacts.DataTextField = "Description" |
contacts.DataValueField = "Description" End Sub |