Some simple operations on ASP control objects, asp control objects

Source: Internet
Author: User

Some simple operations on ASP control objects, asp control objects

Number of online users Application. lock (); Application ["num"] = (Convert. toInt32 (Application ["num"]) + 1 ). toString (); Application. unLock (); Label1.Text = Application ["num"]. toString (); Session Application passed value Session ["user"] = TextBox1.Text; Response. redirect ("Default2.aspx"); the Server encodes and decodes Response. write (Server. urlEncode (" http://www.abc.com "); Virtual Path to absolute path Server. mapPath () uses cookies to obtain the user name or password Response. cookies ["user"]. value = "zhangsan"; Response. cookies ["pass"]. value = "1234"; String str = Response. cookies ["pass"]. value; Label2.Text = "Write successful! "; Read data Label2.Text = Server. htmlEncode (Request. cookies ["user"]. value); Label1.Text = Server. htmlEncode (Request. cookies ["pass"]. the placeholder: string. format Response. redirect (string. format ("Default2.aspx? Username = {0}, pass = {1} ", TextBox2.Text, TextBox3.Text); accept Request. queryString ["user"]. toString (); dropdownlist control switch (DropDownList1.SelectedItem. text. trim () {case "Fujian": {ListBox1.Items. clear (); ListBox1.Items. add ("Fuzhou"); ListBox1.Items. add ("Xiamen"); ListBox1.Items. add ("Quanzhou"); break;} case "Guangdong": {ListBox1.Items. clear (); ListBox1.Items. add ("Guangzhou"); ListBox1.Items. add ("Shantou"); ListBox1.Items. add ("Zhongshan "); Break ;}} ListItem foreach (ListItem l in ListBox1.Items) {if (l. selected = true) {Label1.Text = l. text ;}} for (int I = 0; I <CheckBoxList1.Items. count; I ++) {if (CheckBoxList1.Items [I]. selected) {Label1.Text + = CheckBoxList1.Items [I]. the Text + "" ;}} MApkongjian control requires three condition radius X. Then, you can click "China Map" to jump to the page. <asp: imageMap ID = "ImageMap1" runat = "server" ImageUrl = "~ /Img/p3.jpg "> <asp: CircleHotSpot Radius =" 15 "X =" 10 "Y =" 10 "/> <asp: circleHotSpot Radius = "100" X = "200" Y = "500"/> <asp: circleHotSpot Radius = "40" X = "40" Y = "90"/> <asp: circleHotSpot Radius = "300" X = "400" Y = "600"/> </asp: ImageMap> Transfer method of the server object and respone Redirect () the difference between the two is that the JSP redirection and URL are not changed. The first address should not be changed. After the Transfer jumps to the page, you can also transmit the value in the page. There are multiple methods to Request the value. queryStrnng () Session Application PreviousPage. findControl TextBox tb1 = (TextBox) PreviousPage. findControl ("TextBox2"); TextBox tb2 = (TextBox) PreviousPage. findControl ("TextBox3"); Label1.Text = tb1.Text; Label2.Text = tb2.Text; the master page uses the stored PROCEDURE to use alter procedure dbo. update_user/* (@ parameter1 int = 5, @ parameter2 datatype OUTPUT) */@ sid int, @ sname varchar (20), @ spassword varchar (12 ), @ sex char (10), @ saddress varbinary (50), @ img varbinary (50) AS/* set nocount on */update tb_user set sname = @ sname, spassword = @ spassword, sex = @ sex, saddress = @ saddress, img = @ img RETURN: the stored procedure is used to update the database value in the background.

 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.