Results 1 to 4 of 4

Thread: Fill Combobox of Gridview

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2008
    Posts
    474

    Fill Combobox of Gridview

    Code:
    <asp:GridView ID="Grdview1" runat="server" 
    AutoGenerateColumns="False" 
    AllowPaging ="false" Width="100%" 
    >
        <Columns>
            <asp:TemplateField HeaderText="Cities">
            <ItemTemplate >
            <asp:DropDownList ID="cmb1" runat="server" > 
            <asp:ListItem Value="--Select--" Text="--Select--"></asp:ListItem>
            <asp:ListItem Value="Faridabad" Text="Faridabad"></asp:ListItem>
            <asp:ListItem Value="Delhi" Text="Delhi"></asp:ListItem>
            </asp:DropDownList> 
            </ItemTemplate>
            </asp:TemplateField>
    
    
            <asp:TemplateField HeaderText="Addresses">
            <ItemTemplate >
            <asp:DropDownList ID="cmb2" runat="server" > 
            </asp:DropDownList> 
            </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    I have two comboxes in GridView named cmb1 & cmb2. On selection Changed of cmb1,I want that cmb2 items to be fill from the database.
    How to do dat? I have no idea how to do it. Plz help me!!!!
    Thx in advance.

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Fill Combobox of Gridview

    Hello,

    Have a look here for a walkthrough on how this can be achieved:

    http://www.asp.net/data-access/tutor...opdownlists-cs

    If you are using AJAX, you have the option of using this:

    http://www.asp.net/ajax/ajaxcontrolt...gDropDown.aspx

    Hope that helps!

    Gary

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2008
    Posts
    474

    Re: Fill Combobox of Gridview

    hi Gep,My Comboboxes is in Gridview..not on form.

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Fill Combobox of Gridview

    That really doesn't matter. You would still apply the same technique.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width