我有一个自动完成文本框和一个从数据库填充的下拉列表现在我想从我从下拉列表中选择一个项目文本框填充该项目 [英] I Have A Autocomplete Textbox And A Dropdown List That Fill From Database Now I Want When I Select A Item From Dropdown List The Textbox Fill Against That Item
本文介绍了我有一个自动完成文本框和一个从数据库填充的下拉列表现在我想从我从下拉列表中选择一个项目文本框填充该项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个文本框,从数据库中填充
和下拉列表,也是从数据库填充的。
所以现在我想,当我在下拉列表中选择一个元素时,文本字段填充该元素
我从数据库通过[webmethod]填充的文本框.as it可能
I have a textbox which is filled from database
and dropdown list which is also filled from database.
So now i want, when i select a element in dropdown list the textfield fill against that element
the textbox which i fill from database through a [webmethod].as it possible
推荐答案
只需使用onchange
DropDownList
的事件并在该事件上调用 JavaScript 方法。使用 jQueryAjax
并调用WebMethod
。
在WebMethod
中,连接到数据库并获取必要的数据并返回 jQueryAjax
呼叫。然后在成功
块的Ajax
调用中分配返回数据。
Just useonchange
Event forDropDownList
and call a JavaScript method on that Event. Use jQueryAjax
and call aWebMethod
.
Inside theWebMethod
, connect to Database and fetch necessary data and return to the jQueryAjax
call. Then assign that return data inside thesuccess
block ofAjax
call.
这篇关于我有一个自动完成文本框和一个从数据库填充的下拉列表现在我想从我从下拉列表中选择一个项目文本框填充该项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文