使用javascript填充表格数据的下拉列表 [英] Populate dropdownlist with table data using javascript

查看:74
本文介绍了使用javascript填充表格数据的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个单选按钮,一个下拉列表和两个文本框。当选择第一个单选按钮时,dropdownlist将填充table1中的数据,如果选择了第二个单选按钮,则dropdownlist将填充table2中的数据。我希望这可以在javascript中完成。



此外我在web.config中指定了连接字符串

I am having two radio buttons, one dropdownlist and two textbox. When first radio button is selected dropdownlist gets populated with data from table1 and if second radio button is selected than dropdownlist gets populated with data from table2. i want this to be done in javascript.

Moreover Ihave connection string specified in web.config

<asp:RadioButton ID="radMail" Text="Mailwise Statistics" runat="server" GroupName="stat_select" onclick="ch(1)" ClientIDMode="Static" /><br />
<asp:RadioButton ID="radDraft" Text="Draftwise Statistics" runat="server" GroupName="stat_select" onclick="ch(2)" ClientIDMode="Static" /><br />
<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>





我的下一个问题是根据从下拉列表中选择的值,数据应该显示在两个文本框中。



In任何一种情况我不希望页面回发。



My next question is accoding to value selected from dropdownlist the data should be displayed in two textboxes.

In any of the case I dont want the page to post back.

推荐答案

您好,



获取数据来自两个表并存储在变量客户端ex:arr1和arr2中。然后根据单选按钮将相应的数组列表绑定到下拉列表。
Hi,

Get data from the both tables and store in a variable client side ex : arr1 and arr2 . Then based on the radio button bind the appropriate array list to the drop down.


这篇关于使用javascript填充表格数据的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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