Combobox inside DataGrid

Discussion in 'ASP .Net Datagrid Control' started by Daniel Caetano, Feb 26, 2004.

  1. Hi all, everybody knows where i can find samples to how create combobox
    inside e datagrid,
    e how to populate it??
     
    Daniel Caetano, Feb 26, 2004
    #1
    1. Advertising

  2. > 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

    http://www.4GuysFromRolla.com
    http://www.ASPFAQs.com
    http://www.ASPMessageboard.com

    * When you think ASP, think 4GuysFromRolla.com!
     
    Scott Mitchell [MVP], Feb 26, 2004
    #2
    1. Advertising

  3. 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!
     
    Barnabas (Barney) Yohannes, Feb 26, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Big E

    DataGrid and combobox

    Big E, Jul 22, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    427
    Curt_C [MVP]
    Jul 22, 2004
  2. T.ARAS

    Multicolumn Combobox in datagrid

    T.ARAS, Aug 5, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    217
    T.ARAS
    Aug 6, 2004
  3. Get
    Replies:
    1
    Views:
    114
    Elton Wang
    Oct 26, 2005
  4. geeta

    binding combobox control to datagrid

    geeta, Oct 27, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    132
    Eliyahu Goldin
    Oct 27, 2005
  5. Replies:
    5
    Views:
    490
    Roedy Green
    Oct 11, 2012
Loading...

Share This Page