Click here to Skip to main content
15,912,493 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My web page contains dropdownlist and two textbox. After selecting item from dropdownlist related data should be filled in two textbox. This should happen without post back.

ASP.NET
<asp:DropDownList ID="ddlSelectMail" runat="server" Width="51px" Height="16px"></asp:DropDownList>
        <asp:TextBox ID="txtMessageId" runat="server" Width="127px"></asp:TextBox></td>
        <asp:TextBox ID="txtSubject" runat="server" Width="301px" Height="16px"></asp:TextBox>
Posted
Comments
Ami_Modi 21-Feb-14 1:40am    
Its so common thing.. Nobody is having answer?

1 solution

<asp:textbox id="Name" runat="server" width="220px" xmlns:asp="#unknown">
<asp:dropdownlist id="Under" runat="server" height="22px" width="223px" onchange="val()" xmlns:asp="#unknown">



function val() {
var date = document.getElementById("&lt;%=Under.ClientID%&gt;").value;
document.getElementById("&lt;%=Name.ClientID%&gt;").value = date;
}
 
Share this answer
 
Comments
Ami_Modi 20-Feb-14 6:29am    
But where shell I fetch data form database and display in textbox?
Abid Shk 20-Feb-14 6:59am    
Use Ajax Update panel to ptrevent postback
Ami_Modi 20-Feb-14 7:01am    
Which controls shell I keep in update panel? The ddl or textbox or all the three?
Er. Ajay Chauhan 20-Feb-14 7:03am    
all these three...
Ami_Modi 20-Feb-14 7:38am    
If I do so three controls will be loaded again and they do not contain value which I got from table and it also do not retain value of ddl. Can u please help me with some code.

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