Introduction:
Here simple method to show selected dropdown list value in
textbox.
This process we can easily do coding on server side, but i
some case without get any post back we can set the dropdown list value in
textbox.
In that case by using JavaScript easily accomplish the
process..
JavaScript:
<script type="text/javascript" >
function
change(id) {
var
txt;
txt = id.value;
document.getElementById("TextBox1").value = id.value;
}
</script>
|
<asp:DropDownList ID="DropDownList1" runat="server" onchange ="change(this);">
<asp:ListItem >Item1</asp:ListItem>
<asp:ListItem>Item2</asp:ListItem>
</asp:DropDownList>
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
|
I hope you like
0 comments:
Post a Comment