我有一个自动完成文本框和一个从数据库填充的下拉列表现在我想从我从下拉列表中选择一个项目文本框填充该项目 [英] 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

查看:87
本文介绍了我有一个自动完成文本框和一个从数据库填充的下拉列表现在我想从我从下拉列表中选择一个项目文本框填充该项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框,从数据库中填充

和下拉列表,也是从数据库填充的。

所以现在我想,当我在下拉列表中选择一个元素时,文本字段填充该元素

我从数据库通过[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 方法。使用 jQuery Ajax 并调用 WebMethod



WebMethod 中,连接到数据库并获取必要的数据并返回 jQuery Ajax 呼叫。然后在成功块的 Ajax 调用中分配返回数据。
Just use onchange Event for DropDownList and call a JavaScript method on that Event. Use jQuery Ajax and call a WebMethod.

Inside the WebMethod, connect to Database and fetch necessary data and return to the jQuery Ajax call. Then assign that return data inside the success block of Ajax call.


这篇关于我有一个自动完成文本框和一个从数据库填充的下拉列表现在我想从我从下拉列表中选择一个项目文本框填充该项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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