The framework of RS (Remote scripting) technology replacing ASP in asp+
Source: Internet
Author: User
The framework of RS (Remote scripting) technology replacing ASP in asp+
Batman
In the above article I mentioned an application of the Page.IsPostBack attribute, which can be used to save user input
Information, I'll introduce another use of it, which is to replace the RS (Remote scripting) technology in ASP.
As for the basic concept and usage of Rs I have a lot of introduction in ASP version, its main advantage is not to refresh
Communicates with the server side in the case of the current page. But because it is using Java technology at the bottom, it uses
Up or appear more cumbersome, I will introduce in the asp+ how to use Page.IsPostBack to replace RS technology.
According to my custom, I like to use specific examples to explain the problem, so this time using a simple example to illustrate
Problem. In the following example, a products.aspx program is used, which has two server-side controls (server-side
Control), which is the new controls introduced in Asp+, one is a drop-down box control-' mudcategories ',
The other is a list box control--' mudproducts '. This example will show that the contents of the list box will follow the contents of the Drop-down box
Changes, and for the convenience of everyone to reproduce, I will use the database examples from SQL Server to implement.
The Products.aspx code is as follows:
<%@ Import namespace= "System.Data"%>
<%@ Import namespace= "System.Data.ADO"%>
<script language= "VB" runat= "Server" >
Sub Page_Load (Sourceobj as Object, Evearg as EventArgs)
If not Page.IsPostBack Then
Dim Mudcommand as Adodatasetcommand
Dim Mudconnection as ADOConnection
Dim DSet as New DataSet
Dim strSQL as String
Dim ConnStr as String
strSQL = "Select CategoryID, CategoryName from Categories"
ConnStr = "Provider = SQLOLEDB; Data source=test; Initial Catalog=northwind; User Id=sa; password=; "
Mudconnection = New adoconnection (connstr)
Mudcommand = New Adodatasetcommand (strSQL, mudconnection)
Mudcommand.filldataset (DSet, "Categories")
Mudcategories.datasource = Dset.tables ("Categories"). DefaultView
Mudcategories.databind ()
End If
End Sub
Sub displayproducts (Source as Object, Evearg as EventArgs)
Dim Mudcommand as Adodatasetcommand
Dim Mudconnection as ADOConnection
Dim DSet as New DataSet
Dim strSQL as String
Dim ConnStr as String
ConnStr = "Provider = SQLOLEDB; Data source=test; Initial Catalog=northwind; User Id=sa; password=; "
From the example program can be seen, which is obviously using the server-side control of the dropdown box onchange event with AutoPostBack and
Page.IsPostBack attribute can be very simple and clear to achieve the previous in the ASP in the cumbersome RS implementation method.
Oh, I hope you have gained from this example above.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.