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 / February 2004

Tip: Looking for answers? Try searching our database.

Combobox inside DataGrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel Caetano - 26 Feb 2004 17:19 GMT
   Hi all, everybody knows where i can find samples to how create combobox
inside e datagrid,
    e how to populate it??
Scott Mitchell [MVP] - 26 Feb 2004 18:42 GMT
>     Hi all, everybody knows where i can find samples to how create combobox
> inside e datagrid, how to populate it??

I discuss this in my book, ASP.NET Data Web Controls Kick Start.

Also, you might want to look into Andy Smith's free RowSelectorColumn:
http://metabuilders.com/Tools/RowSelectorColumn.aspx

Signature

<shameless plug>
 For more information on the DataGrid, DataList, and Repeater controls,
consider picking up a copy of my latest book:

       ASP.NET Data Web Controls
       http://www.amazon.com/exec/obidos/ASIN/0672325012/4guysfromrollaco
</shameless plug>

Happy Programming!

   Scott Mitchell
   mitchell@4guysfromrolla.com
   http://www.4GuysFromRolla.com
   http://www.ASPFAQs.com
   http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!

Barnabas (Barney) Yohannes - 26 Feb 2004 22:41 GMT
In your html section, type the following

<asp:TemplateColumn SortExpression="VName" HeaderText="Vendor"><ItemTemplate><%# Container.DataItem("VName") %></ItemTemplate><FooterTemplate><asp:DropDownList id=VendorA runat="server" DataSource="<%# GetVendors() %>" DataValueField="VName" DataTextField="VName" ></asp:DropDownList></FooterTemplate><EditItemTemplate><asp:DropDownList id=VendorE runat="server" DataSource="<%# GetVendors() %>" DataValueField="VName" DataTextField="VName" SelectedIndex='<%# GetSelectedIndex(Container.DataItem("VName")) %>'/></asp:DropDownList></EditItemTemplate

In your VB Section, type the follwing

Function GetVendors() As DataSe
       Dim da As SqlDataAdapte

       Dim strSQL As Strin
       Dim strCnn As Strin
     
       strSQL = "SELECT Distinct VName FROM  Vendors" 'Constants.SqlStrin
       strCnn = Constants.ConnectionStrin

       da = New SqlDataAdapter(strSQL, strCnn
       ' ddlDataSet = New DataSe

       da.Fill(ddlDataSet, "VTable"

       'Session("DataView") = ds.Tables("VTable").DefaultVie
       Return ddlDataSe

       ' Return Session("DataView") 'Return the DataSe
   End Functio

I am sure you will figure out what you need to do.  Also, on this page, there is a good sample

http://authors.aspalliance.com/das/dgcombo.asp

Good luck!

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.