Several common value passing methods in Asp. Net

Source: Internet
Author: User
View Code

1. The first one is written in the program code,
2
3. In the event of clicking the value transfer, write:
4
5
6
7 Response. Redirect ("adminUpdate. aspx? UserName = "+ gvAdminInFo. selectedRow. cells [1]. text. toString (). trim () + "& userJiaoSe =" + gvAdminInFo. selectedRow. cells [2]. text. toString (). trim () +
8 "& userStart =" + gvAdminInFo. SelectedRow. Cells [3]. ToString (). Trim ());
9 copy code
10
11
12
13
14 when receiving the message on the next page:
15
16
17
18 txtUserName. Text = Request ["userName"]. ToString (). Trim ();
19 txtUserJiaose. Text = Request ["userJiaoSe"]. ToString (). Trim ();
20 txtUseruserStart. Text = Request ["userStart"]. ToString (). Trim ();
21. Copy the code
22
23
24
25
26 2. The second is written in the interface tag,
27 write in the mark as follows:
28
29 <asp: HyperLink id = HyperLink1 runat = "server" NavigateUrl = '<% # DataBinder. Eval (Container. DataItem, "SendUserName", "SendSMsg. aspx? QID = {0} ") %> 'text = '<% # DataBinder. Eval (Container. DataItem," SendUserName ") %> 'target =" _ blank ">
30 </asp: HyperLink>
31. Copy the code
32
33
34
35
36
37
38 when the program receives the message
39
40 txtUserName. Text = Request ["SendUserName"]. ToString (). Trim ();
41
42
43
44
45 3. If we have multiple values, you can also pass it like this, (this article is reproduced from http://sufei.cnblogs.com /)
46
47
48
49 Code
50 <asp: HyperLink ID = "HyperLink2" NavigateUrl = '<% # DataBinder. Eval (Container. DataItem, "ID ","~ /Admin/passwordUpdate. aspx? ID = {0} ") + DataBinder. eval (Container. dataItem, "UserName", "& UserName = {0}") %> 'runat = "server"> Reset </asp: HyperLink>

 

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.