The framework of RS (Remote scripting) technology replacing ASP in asp+
Source: Internet
Author: User
From Active.com.cn
An application of the Page.IsPostBack attribute is to replace the RS (Remote scripting) technology in ASP. As for the basic concepts and usage of Rs I have been in ASP
Version has a lot of introduction, its main advantage is not to refresh the current page and the server side of the communication. But because the bottom of it is using the
Java technology, so it is still more cumbersome to use, I will introduce in the asp+ how to use Page.IsPostBack to replace RS technology.
It is my custom to use specific examples to explain the problem, so this time using a simple example to illustrate the problem. In the following example, the
With a products.aspx program, it has two server-side controls (Server-side control), which is the new control programmer introduced in asp+
, one is a drop-down box control--' mudcategories ', and the other is a list box control-' mudproducts '. This example will demonstrate that the list box
Will change with the content in the dropdown box, and for the convenience of everyone to reproduce it, I will use the database example from SQL Server to implement.
The Products.aspx code is as follows:
Code:
---------------------------------------------------------------------
<%@ import namespace= "System.Data"%><%@ import namespace= "System.Data.ADO"%><script "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 IfEnd SubSub 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
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.