473,413 Members | 1,755 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,413 software developers and data experts.

How to use a DropDownList in a GridView?

S_K
I have a GridView that has a DropDownList in one of the columns.
When I edit and update any row I would like to grab the SelectedValue
of that DropDownList when I'm in the GridView_RowUpdating event.

Any ideas?

Sep 27 '07 #1
3 1942
Hi,

You can refer to the following code to get the SelectedValue of the
DropDownList in the GridView_RowUpdating event.

Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles
GridView1.RowUpdating
Dim s As String =
CType(GridView1.Rows(e.RowIndex).FindControl("Drop DownList1"),
DropDownList).SelectedValue.ToString()
Response.Write(s)
End Sub

Hope this helps.

Regards,
Manish

"S_K" wrote:
I have a GridView that has a DropDownList in one of the columns.
When I edit and update any row I would like to grab the SelectedValue
of that DropDownList when I'm in the GridView_RowUpdating event.

Any ideas?

Sep 28 '07 #2
Hi,

If you also want to know how you can use the DropDownList control in
GridView control then you can add a TemplateField in the GridView control and
then add the DropdwonList control in the ItemTemplate of that template column.

Regards,
Manish

You can also

"S_K" wrote:
I have a GridView that has a DropDownList in one of the columns.
When I edit and update any row I would like to grab the SelectedValue
of that DropDownList when I'm in the GridView_RowUpdating event.

Any ideas?

Sep 28 '07 #3
S_K
On Sep 28, 12:48 am, Manish <Man...@discussions.microsoft.comwrote:
Hi,

If you also want to know how you can use the DropDownList control in
GridView control then you can add a TemplateField in the GridView control and
then add the DropdwonList control in the ItemTemplate of that template column.

Regards,
Manish

You can also

"S_K" wrote:
I have a GridView that has a DropDownList in one of the columns.
When I edit and update any row I would like to grab the SelectedValue
of that DropDownList when I'm in the GridView_RowUpdating event.
Any ideas?- Hide quoted text -

- Show quoted text -
Thanks that worked!

Steve

Sep 28 '07 #4

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

Similar topics

6
by: Dabbler | last post by:
I have a dropdownlist in a GridView ItemTemplate. I need to bind the ddl to an SqlDataSource, then have a value from a boundfield in the row be passed as the keyfield for select where clause. Im...
0
by: dawg1998 | last post by:
I am able to populate a DropDownList control within multiple rows of a GridView with the following code: `````````````````````````````````````````````````````` <asp:GridView id="gvGridView"...
0
by: Ben | last post by:
Hi, It's about a database containing (for simplifying) three fields: 'placenr' (primary key), 'place' and 'color'. The records are updatable (Edit/Update button) in a gridview. For updating the...
7
by: AG | last post by:
Hi, ASP.NET 2.0 web app I have a GridView utilizing template columns and bound to an objectdatasource. In the edit template of one column there is a dropdownlist bound to another...
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: 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...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.