473,409 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

DropDownList in GridView

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.
Jun 26 '06 #1
3 1395
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>

Jun 26 '06 #2
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>

Jun 26 '06 #3
- Could you copy and paste your code here.

Jun 26 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: sgtmarcjones | last post by:
How do I access a dropdownlist that is nested within a Formview ItemTemplate Gridview Template? I want to see a label (lgbTimeKeep ! TextValue of ddlName dropdownlist) instead of a dropdownlist...
3
by: Brian VanDyke | last post by:
I have to display a table with customer data (GridView). However, I want to be able to show DropDownList controls inside one of the columns, not just textbox controls. Is this possible? Is it...
0
by: lamolap | last post by:
i have 1 gridview , a dropdownlist inside a gridview and a commandfield of (edit, update and cancel) my gidview looks like this Edit Surname Initials ...
1
by: Anilsg | last post by:
Hi all, I have the DropDownList in the FormView,inside InsertTemplateField The data is binded in run time to it in codebehind page,FOr the First time the page is loaded the DropdownList is...
0
by: Fabrizio | last post by:
Hi all. I have a field in a gridview as templatefield which is a label in view mode and a dropdownlist in edit mode with his datasource. This gridview is inserted as templatefield in another...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.