Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ASP.NET
<asp:DropDownList ID="drp1" runat="server"
          DataSourceID="SqlDataSource1" DataTextField="fid" DataValueField="fid">
      </asp:DropDownList>
  </p>
  <p>
      <asp:SqlDataSource ID="SqlDataSource1" runat="server"
          ConnectionString="<%$ ConnectionStrings:dataproofConnectionString2 %>"
          SelectCommand="SELECT [fid] FROM [filearchive]"></asp:SqlDataSource>
  </p>
  <p>
      <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

      
      <asp:Button ID="Button1" runat="server" Text="Edit" />

how to reterive data in text box
Posted

1 solution

On the server side (during PostBack) use C#'s Textbox2.Text = "The text you wish to update";

e.g.:
C#
Textbox2.Text = drp1.Value;


On the client side in Javascript (jQuery):
JavaScript
document.getElementById("Textbox_ClietnUD") =  $("#DDL_ClientId option:selected").text();

Note that for this to work you will need the client ID (which is auto generated by the page) of the Textbox and the DropDownList.
Each Control's client id can be accessed (in C# in advance) via the Control.ClientID Property.

Best,
H
 
Share this answer
 
v3

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