使用Javascript onClick从SQL Server自动填充 [英] Auto populate from SQL server using Javascript onClick

查看:94
本文介绍了使用Javascript onClick从SQL Server自动填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面使用此Javascript将控件动态添加到asp.net Web表单,该表单运行得很好.我需要在按钮上添加onClick事件,以从SQL Server数据库中提取数据以自动填充文本框.有人可以帮我还是指导我怎么做.


Javascript代码
--------------------

I am using this Javascript below to dynamically add controls to an asp.net web form, which is working perfectly well. I need to add onClick event to the Button to pull data from SQL server database to auto populate the textboxes. Can somebody help me or guide me how to do that.


Javascript code
--------------------

<script type="text/javascript">
       function addRow(tableID)
       {
           var newRow = document.getElementById("empRec1").insertRow(0);

           var oCell = newRow.insertCell(0);
           oCell.innerHTML = "<input type='Button' name='t1' size='9' Value='Select Employee'>";
           oCell = newRow.insertCell(1);
           oCell.innerHTML = "<input type='text' name='t2' size='2'>";
           oCell = newRow.insertCell(1);
           oCell.innerHTML = "<input type='text' name='t2' size='2'>";
           oCell = newRow.insertCell(1);
           oCell.innerHTML = "<input type='text' name='t2' size='2'>";
           oCell = newRow.insertCell(1);
           oCell.innerHTML = "<input type='text' name='t2' size='2'>";

       }



   </script>

推荐答案

,您可以使用原始的ajax来实现..
请查看此链接以获取示例代码..
you can use raw ajax to achieve this..
check out this link for sample code..
Raw AJAX

[

这篇关于使用Javascript onClick从SQL Server自动填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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