See i have also used the Update Panel but i am able to change the Textbox value. here is my code.
Make sure the TextBox is inside UpdatePanel
HTML:
<form id="form1" runat="server">
<div>
<asp:ScriptManager runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="upUpdatePanel" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlDropDownDemo" AutoPostBack="True" OnSelectedIndexChanged="DropdownlistChanged"
runat="server">
</asp:DropDownList>
<asp:TextBox ID="txtDemo1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
C#:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindDropDownList();
}
}
private void BindDropDownList()
{
string constr = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString;
using (SqlConnection _cn = new SqlConnection(constr))
{
using (SqlCommand _cmd = new SqlCommand("SelectName", _cn))
{
_cmd.CommandType = CommandType.StoredProcedure;
_cn.Open();
using (SqlDataReader _dr = _cmd.ExecuteReader())
{
if (_dr.HasRows)
{
ddlDropDownDemo.DataSource = _dr;
ddlDropDownDemo.DataTextField = "LastName";
ddlDropDownDemo.DataValueField = "EmployeeID";
ddlDropDownDemo.DataBind();
}
}
_cn.Close();
}
}
}
protected void DropdownlistChanged(object sender, EventArgs e)
{
txtDemo1.Text = "correct";
}
Thanks & Regards,
Azimuddin.