ive been trying to experiment on dropdownlist in a grid..i cannot get
anything to work...i tried to have some code in the editcommand using
the Findcontrol but its really frustrating ...
anybody is kind enough to help out..
TIA
ashelley@inlandkwpp.com - 29 Jun 2004 01:07 GMT
>ive been trying to experiment on dropdownlist in a grid..i cannot get
>anything to work...i tried to have some code in the editcommand using
[quoted text clipped - 3 lines]
>
>TIA
Here's my example:
<asp:TemplateColumn SortExpression="STE" HeaderText="State">
<ItemTemplate>
<asp:Label Runat="server" Text='<%#
((SortedList)Session["stateTypes"])[(((System.Data.DataRowView)Container.DataItem)["STE"])]
%>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList runat="server" DataSource='<%#
((SortedList)Session["stateTypes"]) %>' SelectedIndex='<%#
((SortedList)Session["stateTypes"]).IndexOfKey(((System.Data.DataRowView)Container.DataItem)["STE"])
%>' DataValueField="Key" DataTextField="Value" ID="ddlState">
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateColumn>
and i have something like this in my codebehind when the page loads
up.
stateTypes = new SortedList();
stateTypes.Add("","");
stateTypes.Add("W","Waiting");
stateTypes.Add("H","On Hold");
stateTypes.Add("I","In Process");
Session["stateTypes"] = stateTypes;
hope this helps.
-Adam
Saravana [MVP] - 29 Jun 2004 05:15 GMT
Check out this article,
http://msdn.microsoft.com/library/en-us/dv_vstechart/html/vbtchTopQuestionsA
boutASPNETDataGridServerControl.asp?frame=true#vbtchtopquestionsaboutaspnetd
atagridservercontroleditingmultiplerows
--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com
> ive been trying to experiment on dropdownlist in a grid..i cannot get
> anything to work...i tried to have some code in the editcommand using
[quoted text clipped - 3 lines]
>
> TIA