Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,495 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,706 people online right now. Registration is fast and FREE... Join Now!




# How to display selected value of dropdownlist into the gridview.

 
Reply to this topicStart new topic

# How to display selected value of dropdownlist into the gridview.

Rg2005
5 Feb, 2008 - 03:50 AM
Post #1

New D.I.C Head
*

Joined: 20 Sep, 2007
Posts: 9



Thanked: 1 times
My Contributions

I have two dropdown in my form.i also set the initial value of both dropdown to (--).i have one addbutton on my form.after adding,i want to display selected value in the dropdownlist into the gridview.pleas help me to do this.


User is offlineProfile CardPM
+Quote Post

zakary
RE: # How To Display Selected Value Of Dropdownlist Into The Gridview.
5 Feb, 2008 - 06:44 AM
Post #2

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 405



Thanked: 6 times
Dream Kudos: 175
My Contributions
QUOTE(Rg2005 @ 5 Feb, 2008 - 06:50 AM) *

I have two dropdown in my form.i also set the initial value of both dropdown to (--).i have one addbutton on my form.after adding,i want to display selected value in the dropdownlist into the gridview.pleas help me to do this.


try this it will add the selected item to your gridview
note that Rows[0] and Cells[0] is the first row first column.

gridview.Rows[0].Cells[0].Value = dropdown.SelectedItem.ToString();
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: # How To Display Selected Value Of Dropdownlist Into The Gridview.
5 Feb, 2008 - 11:15 AM
Post #3

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,993



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
While we don't just hand code out here at </dream.in.code> we don't have a problem nudging you in the right direction, but you have to write the code first, and if you run into problems with the code you're writing post it here, using code tags like so code.gif
User is offlineProfile CardPM
+Quote Post

stapes
RE: # How To Display Selected Value Of Dropdownlist Into The Gridview.
22 May, 2008 - 08:28 AM
Post #4

New D.I.C Head
*

Joined: 22 May, 2008
Posts: 3

QUOTE(zakary @ 5 Feb, 2008 - 07:44 AM) *

QUOTE(Rg2005 @ 5 Feb, 2008 - 06:50 AM) *

I have two dropdown in my form.i also set the initial value of both dropdown to (--).i have one addbutton on my form.after adding,i want to display selected value in the dropdownlist into the gridview.pleas help me to do this.


try this it will add the selected item to your gridview
note that Rows[0] and Cells[0] is the first row first column.

gridview.Rows[0].Cells[0].Value = dropdown.SelectedItem.ToString();


I tried this solution but it would not compile. It does not like the word Value.

Does anyone have the correct answer?

Stapes
User is offlineProfile CardPM
+Quote Post

eclipsed4utoo
RE: # How To Display Selected Value Of Dropdownlist Into The Gridview.
22 May, 2008 - 08:33 AM
Post #5

D.I.C Regular
Group Icon

Joined: 21 Mar, 2008
Posts: 363



Thanked: 19 times
Dream Kudos: 25
My Contributions
QUOTE(stapes @ 22 May, 2008 - 09:28 AM) *

QUOTE(zakary @ 5 Feb, 2008 - 07:44 AM) *

QUOTE(Rg2005 @ 5 Feb, 2008 - 06:50 AM) *

I have two dropdown in my form.i also set the initial value of both dropdown to (--).i have one addbutton on my form.after adding,i want to display selected value in the dropdownlist into the gridview.pleas help me to do this.


try this it will add the selected item to your gridview
note that Rows[0] and Cells[0] is the first row first column.

gridview.Rows[0].Cells[0].Value = dropdown.SelectedItem.ToString();


I tried this solution but it would not compile. It does not like the word Value.

Does anyone have the correct answer?

Stapes


try:

gridview.Rows[0].Cells[0].Text
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 08:01PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month