如何从jquery获取sql server值? [英] How to get sql server value from jquery?

查看:84
本文介绍了如何从jquery获取sql server值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将数据库值加载到文本框对应的下拉列表中。我正在使用



 < script  >  
$(document).ready(function(){
$( .ddl)。change(function(){
$( this )。next( input.text)。val($( this ).val());
});
});
< / script >







(html coade)

 @ Html.DropDownListFor(model = >  model.SupplierId,(SelectList)(ViewData [  SupplierId]),  [ - 请选择 - ] new  {@ class =   ddl,style =   width:310px; Height:30px} )

< input id = myText class = text />





但它不应该选择val从database.how我可以在tex框中加载值吗?

解决方案

(document).ready(function(){


。ddl)。change(function(){


this )。next( 输入。文本)。VAL(

i want to load the database value to the text box corresponding dropdown list. i am using

<script>
 $(document).ready(function () {
            $(".ddl").change(function () {
                $(this).next("input.text").val($(this).val());
            });
        });
</script>




(html coade)

@Html.DropDownListFor(model => model.SupplierId, (SelectList)(ViewData["SupplierId"]), "[ -- Please Select --]", new {@class="ddl", style = "width:310px; Height:30px" })
       
    <input id="myText" class="text" />



but it should not pick value from database.how can i load value in tex box?

解决方案

(document).ready(function () {


(".ddl").change(function () {


(this).next("input.text").val(


这篇关于如何从jquery获取sql server值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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