DropDownList in GridView

Discussion in 'ASP .Net' started by =?Utf-8?B?U3JpZGhhcg==?=, Jun 26, 2006.

  1. Hi,

    I am having some problems with dropdownlist in .NET 2.0. When I drag a
    drop down list on to the webform and if I try to set the SelectedValue
    property for the dropdown list, I am getting errors. The intellisense is not
    showing SelectedValue property for the dropdown list. I am not knowing why it
    is not showing the SelectedValue property for the dropdown lists. With this
    problem, I am not able to set the SelectedValue property for the dropdown
    lists inside the GridView in EditItemTemplate. If I am not able to set the
    SelectedValue property for dropdownlist in design view, Which event can let
    me set the SelectedValue property?

    Please let me know.

    Thanks,
    Sridhar.
    =?Utf-8?B?U3JpZGhhcg==?=, Jun 26, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?U3JpZGhhcg==?=

    Bhuvana Guest

    Hi Sridhar,

    It works for me.

    <asp:TemplateField HeaderText="Category Names">
    <ItemTemplate>
    <asp:Label ID="lblCity" runat="server"
    Text='<%#Eval("CategoryName") %>'></asp:Label>

    </ItemTemplate>
    <EditItemTemplate>
    <asp:DropDownList ID="ddlCountry" runat="server"
    AppendDataBoundItems="true" AutoPostBack="True" SelectedValue='<%#
    Bind("CategoryName") %>' DataMember="DefaultView"
    DataSourceID="AccessDataSource1" DataTextField="CategoryName">

    <asp:ListItem>Select an Item</asp:ListItem>

    </asp:DropDownList>

    </EditItemTemplate>
    </asp:TemplateField>
    Bhuvana, Jun 26, 2006
    #2
    1. Advertising

  3. Hi,

    Thanks for the response. When I put SelectedValue property in the
    <asp:DropDownList> tag it is giving error "Server tag is not well formed". I
    am not able to see SelectedValue property in the properties list for
    DropDownList. I am not sure what the problem is.

    Please let me know if you have any idea.

    Thanks,
    Sridhar.

    "Bhuvana" wrote:

    > Hi Sridhar,
    >
    > It works for me.
    >
    > <asp:TemplateField HeaderText="Category Names">
    > <ItemTemplate>
    > <asp:Label ID="lblCity" runat="server"
    > Text='<%#Eval("CategoryName") %>'></asp:Label>
    >
    > </ItemTemplate>
    > <EditItemTemplate>
    > <asp:DropDownList ID="ddlCountry" runat="server"
    > AppendDataBoundItems="true" AutoPostBack="True" SelectedValue='<%#
    > Bind("CategoryName") %>' DataMember="DefaultView"
    > DataSourceID="AccessDataSource1" DataTextField="CategoryName">
    >
    > <asp:ListItem>Select an Item</asp:ListItem>
    >
    > </asp:DropDownList>
    >
    > </EditItemTemplate>
    > </asp:TemplateField>
    >
    >
    =?Utf-8?B?U3JpZGhhcg==?=, Jun 26, 2006
    #3
  4. =?Utf-8?B?U3JpZGhhcg==?=

    Bhuvana Guest

    - Could you copy and paste your code here.
    Bhuvana, Jun 26, 2006
    #4
    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. mr2_93
    Replies:
    1
    Views:
    3,593
    mr2_93
    Oct 2, 2005
  2. =?Utf-8?B?SnVhbmpv?=

    GridView: Filtr DropDownList from another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,860
    =?Utf-8?B?SnVhbmpv?=
    Dec 23, 2005
  3. =?Utf-8?B?SnVhbmpv?=

    GridView: Filter DropDownList for another DropDownList

    =?Utf-8?B?SnVhbmpv?=, Dec 29, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,293
    =?Utf-8?B?SnVhbmpv?=
    Dec 29, 2005
  4. keithb
    Replies:
    1
    Views:
    11,950
    shauns1
    Nov 1, 2006
  5. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    17,957
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
Loading...

Share This Page