客户端动态数据更改

客户端动态数据更改

问题描述:

大家好.
我正在做一个项目,对asp.net还是很陌生.方案是:
页面上有一个asp.net下拉列表.根据在下拉列表控件中所做的选择,另一个TextBox的内容将更改,而不会回发到服务器.这必须在客户端完成.
我该怎么做?谁能指导我入门教程?
有关种类信息...我正在将VisualStudio2008与.net framework 3.5配合使用
任何帮助将不胜感激.

Hello people.
I am working on a project and I am very new to asp.net.The scenario is:
There is a asp.net dropdownlist on a page. Based on the selection made in the dropdownlist control, another TextBox''s content will change with no post back to the server. This must be done on the client side.
How can I do it? Can anyone guide me to a beginners tutorial?
For kind info...I am using VisualStudio2008 with .net framework 3.5
Any help will be highly appreciated.

这可以通过不同的方式来实现.

1.使用javascript(纯粹是客户端)
2.使用AJAX

使用客户端脚本 [
This can be achieved in different ways.

1. Using javascript (purely client side)
2. Using AJAX

Take a look at the MSDN article on Working with Client-side Script[^]. Since you are new to asp.net, its worth spending sometime.

Coming to your question, set the onchange attribute in codebehind page as

ddl.Attributes["onchange"] = "javaScriptFunctoChangeTextbox();";



然后在javascript页面中添加javascript.



And you add the javascript in the aspx page.