Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / DataGrid / June 2004

Tip: Looking for answers? Try searching our database.

dropdownlist in datagrid.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joriz - 29 Jun 2004 00:59 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
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.