我有一个自动完成文本框和一个从数据库填充的下拉列表现在我想从我从下拉列表中选择一个项目文本框填充该项目

问题描述:

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

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

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

我从数据库通过[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.