DropDownList in GridView

G

Guest

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

Bhuvana

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>
 
G

Guest

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.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top