T
tshad
I am trying to copy the Value and Text column of a DropDownList to a
GridView.
With my GriView:
<asp:GridView ID="GridView2" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblJobs" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp
ropDownList ID="ddlBuckets" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblJobIDs" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp
ropDownList ID="ddlBuckets" runat="server">
<asp:ListItem Value="1"
Selected="True">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
</asp
ropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
If I do:
GridView2.DataSource = ddlJob.Items.Cast<ListItem>().Skip(1).ToArray();
GridView2.DataBind();
It copies the whole list (Value, Text, Enabled, Selected)
What I want to do is copy the Value into lblJobs and the Text into lblJobIDs
and then have the ddlBuckets to show in each row (which it does).
Can I do this automatically or do I need to create the rows manually?
Thanks,
Tom
GridView.
With my GriView:
<asp:GridView ID="GridView2" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblJobs" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblJobIDs" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
<asp:ListItem Value="1"
Selected="True">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
</asp
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
If I do:
GridView2.DataSource = ddlJob.Items.Cast<ListItem>().Skip(1).ToArray();
GridView2.DataBind();
It copies the whole list (Value, Text, Enabled, Selected)
What I want to do is copy the Value into lblJobs and the Text into lblJobIDs
and then have the ddlBuckets to show in each row (which it does).
Can I do this automatically or do I need to create the rows manually?
Thanks,
Tom