Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Passing selected row from gridview to dropdown

Reply
Thread Tools

Passing selected row from gridview to dropdown

 
 
PetroTiburcio PetroTiburcio is offline
Junior Member
Join Date: May 2013
Posts: 7
 
      05-17-2013
Kindly help me passing selected row in gridview to my dropdown. I have 1 gridview, 1 textbox and 1 dropdown list box. My dropdown is populated by SqlDataSource from my table Country. On my gridview, I have 3 columns, which are SELECT, NAME and COUNTRY. Under SELECT column, I have my hyperlinked Select, every time I clicked on a certain row NAME will pass in textbox (no problem with that), but in my dropdown it does not populates the COUNTRY that I choose. For example, I have Jack for name and USA for country. Beside Jack and USA, I have a hyperlink Select, when I click Select, Jack will display on my textbox and supposed to be USA will display on my dropdown but not displaying instead it says an error "'cboCountry' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value".

I have tried the codes below:

Code:
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
{
txtname.Text = GridView2.SelectedRow.Cells[1].Text;
cboCountry.Text = GridView2.SelectedRow.Cells[2].Text;
}
Only the textbox os working, no luck at all in dropdown...I'm using c# and asp.net. Any help would be appreciated. Thanks in advance. God Bless
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gridview: embedding a texbox and button in each row, passing info from that row to a function? Ken Fine ASP .Net 4 07-14-2008 07:51 AM
1 Gridview. Dropdown A is column from database, Dropdown B is column from database, Data in A and B must be from same row. anonymoushamster@gmail.com ASP .Net 2 11-07-2007 12:40 PM
Want to add row under selected row of gridview ujjc001@gmail.com ASP .Net Building Controls 1 02-16-2007 07:14 PM
Selected Row Only GridView Row Visible? needin4mation@gmail.com ASP .Net Web Controls 0 10-17-2006 10:07 PM
bind a dropdown in a column in a datagrid based on the dropdown value selected in another column of the datagrid. vishnu ASP .Net 1 03-25-2006 01:24 PM



Advertisments