This is a migrated thread and some comments may be shown as answers.

Going crazy trying to figure out...

1 Answer 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Spacewarp
Top achievements
Rank 1
Spacewarp asked on 25 Sep 2008, 10:03 PM
I have a project I'm working on in which I'm doing dynamic file uploads.  If the user wants to upload 4 files, fine, I provide them 4 lines in a grid.  I've worked out all the parts except one.  When they put in 4 in the box, and they get their 4 lines, there should be an ID column, a dropdown list with the different file types, a file uploader, a check box if they want to fax the file in and a status line.

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.

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 29 Sep 2008, 09:24 AM
Tags
Grid
Asked by
Spacewarp
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or