Click here to Skip to main content
15,992,761 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to value change in text box when we change the value in drop down list
Posted
Comments
Richard MacCutchan 3-Jan-14 5:32am    
Use binding.
Karthik_Mahalingam 3-Jan-14 5:33am    
please provide more info?
in javascript or c# ?
Where is the problem?

Write the code to change textbox text ,inside the dropdown list selected index changed event.

C#
protected void Dropdownlist1_SelectedIndexChanged(object sender, EventArgs e)
   {
         TextBox1.Text=""; // Change value here

   }
 
Share this answer
 
C#
you can do the same from aspx page also using javascript.

follow the  below code

<asp:dropdownlist id="ddlreport" runat="server" onclick="fnconchange()" xmlns:asp="#unknown">
<asp:textbox id="txtname" runat="server"></asp:textbox>


<script type="text/javascript">
function fnconchange()
{
var ddlReport = document.getElementById("<%=ddlreport.ClientID%>");
       var Text = ddlReport.options[ddlReport.selectedIndex].text;
       var Value = ddlReport.options[ddlReport.selectedIndex].value;
if(Value =="ram")//(your selected value
{
document.getElementById("<%=textBox.ClientID%>").value = "ram";
}

}
</script></asp:dropdownlist>
 
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