当弹出下拉列表如何在文本框中添加数据时 [英] whenver popup dropdownlist how to add data in text box

查看:63
本文介绍了当弹出下拉列表如何在文本框中添加数据时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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

推荐答案

ConnectionStrings:dataproofConnectionString2%>
< span class =code-attribute> SelectCommand = SELECT [fid] FROM [filearchive] > < / asp:SqlDataSource >
< span class =code-keyword>< / p >
< p >
< asp:TextBox ID = TextBox2 runat = 服务器 > < / asp:TextBox >


< asp:按钮 ID = Button1 runat = 服务器 正文 = 编辑 / >
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


在服务器端(在PostBack期间)使用C#的 Textbox2.Text =您要更新的文本;



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

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





在Javascript(jQuery)的客户端:



On the client side in Javascript (jQuery):

document.getElementById("Textbox_ClietnUD") =


#DDL_ClientId选项:选择)。text();
("#DDL_ClientId option:selected").text();



请注意,要使其工作,您将需要Textbox和DropDownList的客户端ID(由页面自动生成)。

可以通过 Control.ClientID 属性访问每个Control的客户端ID(在C#中提前)。



Best,

H


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


这篇关于当弹出下拉列表如何在文本框中添加数据时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆