Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to display gridview selected row value to dropdownlist.

for that my code as follows
C#
protected void gvFacdet_SelectedIndexChanged(object sender, EventArgs e)
   {
       txt_name.Text = gvFacdet.SelectedRow.Cells[1].Text.ToString();
       ddldesg.Items.Add(gvFacdet.SelectedRow.Cells[2].Text.ToString());
   }

In gridview row as follows
             Name                 Designation
select       Ramesh               Courseofficer

in run mode as follows
Name                textbox
Designation         dropdownlist


When i select the gridview row value that gridview selected row value to be displayed in respective textbox and dropdownlist

In textbox name to be displayed and dropdownlist designation to be displayed.

please help me what is the problem in my above code.
Posted
Updated 11-Aug-15 20:14pm
v3
Comments
Arasappan 12-Aug-15 3:40am    
I think to u want this for editing purpose..Am I right

First make a list.Then add items in the list.Then make list as data source of drop down.It will work.
 
Share this answer
 
In gridview row command event ,get the id when u r selecting and set value to textbox as well as dropdown.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900