Hi, I suggest to you a javascript client solution: add this javascript function somewhere in your project
function selectChoice(ddl, textboxID) {
var chosenoption = ddl.options[ddl.selectedIndex];
if (chosenoption.value != 'nothing') {
document.getElementById(textboxID).value = chosenoption.value;
}
}
add onrowdatabound event for your grid with this code:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList ddlChoice = e.Row.FindControl("ddlChoice") as DropDownList;
TextBox txtSelectedValue = e.Row.FindControl("txtSelectedValue") as TextBox;
string jScript = "selectChoice(this, '{0}');";
ddlChoice.Attributes.Add("onchange", string.Format(jScript, txtSelectedValue.ClientID));
}
}
____________________ Web Programmer http://glucolo.wordpress.com
modified on Monday, July 4, 2011 6:10 AM