如何在gridview中绑定dropdownlist选择的值 [英] how to bind dropdownlist selected value in gridview

查看:129
本文介绍了如何在gridview中绑定dropdownlist选择的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  string  str = DDLSelJob.selectedvalue; 
for (i = 0 ; i < ; GridView1.Rows.Count; i ++)
{

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







如何获取外部(gridview)下拉列表选择的值绑定到gridview 。

解决方案

您好,



请尝试以下代码

< pre lang =c#> 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;
}







已添加标签。

[/编辑]


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.

解决方案

Hi,

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.
[/Edit]


这篇关于如何在gridview中绑定dropdownlist选择的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆