Click here to Skip to main content
15,120,268 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
string str = DDLSelJob.selectedvalue;
       for (i = 0; i < GridView1.Rows.Count; i++)

           TextBox txtjob1 = (TextBox)GridView1.Rows[i].FindControl("txtjob1");

how to get outside(gridview) dropdownlist selected value is binding into gridview.
Francine DeGrood Taylor 29-May-14 12:08pm
You need to give us more detail. It looks like what you are doing is taking the value that the user selected in the dropdown list and putting that value into a textbox in the grid.

What is the problem? Does it not work? Are you getting an error? Or it this not what you are trying to do? Please describe in detail what is currently happening, and what you want to happen (instead).

1 solution


Please try the below code
protected void DDLSelJob_SelectedIndexChanged(object sender, System.EventArgs e)
    TextBox GradeText = default(TextBox);
    GradeText = (TextBox)GridView1.FindControl("txtjob1");
    DropDownList txtjob1= (DropDownList)GridView1.FindControl("DDLSelJob");
    GradeText.Text = DDLSelJob.SelectedValue;

[Edit member="Tadit"]
Added pre tags.

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