Combobox inside DataGrid

D

Daniel Caetano

Hi all, everybody knows where i can find samples to how create combobox
inside e datagrid,
e how to populate it??
 
S

Scott Mitchell [MVP]

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

--

<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
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

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

Barnabas (Barney) Yohannes

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top