I can't dynamically populate the dropdownlist.
I tried doing it as an itemtemplate, and that didn't work well. I then went to a griddropdowncolumn. And I can get it to display the empty line, but not the dropdownlist.
Here's the code:
<
telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource">
<MasterTableView AutoGenerateColumns="false">
<Columns>
<telerik:GridBoundColumn DataField="ID" visible="true"></telerik:GridBoundColumn>
<telerik:GridDropDownColumn HeaderText="Document type" UniqueName="DocType" DataField="DocVal"
ListTextField="SubmitForm" ListValueField="DocVal" DropDownControlType="DropDownList"
EnableEmptyListItem="true" EmptyListItemText="---Choose an option--">
</telerik:GridDropDownColumn>
<telerik:GridTemplateColumn HeaderText="File to upload" UniqueName="TemplateColumn1">
<ItemTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Will Fax Later" UniqueName="TemplateColumn2">
<ItemTemplate>
<asp:CheckBox ID="FaxLater" runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Status" UniqueName="TemplateColumn3">
<ItemTemplate>
<asp:Label ID="Status" runat="server" Text=" "></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
ds = GetSecondaryData()
Dim i As Integer
For i = 0 To FileCount - 1
arr.Add(FileCount)
Next
'Dim ddl As DropDownList
'ddl = RadGrid1.Items("TemplateColumn").FindControl("DDL1")
'ddl.DataSource = ds
'ddl.DataBind()
Dim table As DataTable = New DataTable()
table.Columns.Add(
"ID")
table.Columns.Add(
"SubmitForm")
table.Columns.Add(
"DocVal")
For i = 0 To arr.Count - 1
Dim row As DataRow = table.NewRow()
row(
"ID") = i
row(
"SubmitForm") = ds.Tables(0).Rows(i).Item(1)
row(
"DocVal") = ds.Tables(0).Rows(i).Item(0)
table.Rows.Add(row)
Next
RadGrid1.DataSource = table
RadGrid1.DataBind()
RadGrid1.Visible =
True
ds is a dataset populated with two columns, DocVal and SubmitForm.
arr is an Array.
I'm in kind of a bind here. I've been beating my head on the wall with this all day. Any help would be greatly appreciated.