asp.net multiple values to other pages of the specific implementation

Source: Internet
Author: User

  In the jump between the pages, often used to pass the value, which may pass multiple values, below to introduce the next asp.net to pass multiple values to other pages of the method, the need for friends can refer to the following

In web development, jumps between pages are often used to pass values, which may pass multiple values.     Commadargument multiple values to other pages.   in data-bound controls such as the GridView DataList Repeater, you can use Commadargument to pass multiple values.   Source code (ASPX page code) is as follows: This code is generally written in the item template, if you use the first method does not need to add onclick event, directly click on the data-bound control Rowcommand, ItemCommand event, on the line.     Code as follows: <asp:imagebutton id= "Editimagebutton" runat= "Server" imageurl= "~/images/bt_edit.gif" Commandargument= ' <% #Eval ("dict_id") + "," +eval ("Dict_type")%> ' onclick= ' editimagebutton_click ' Height= ' "20" Width= "/> "   Method 1, if you use the GridView control, find the Rowcommand event double-click, use the Datalist,repeater control to find the ItemCommand event double-click, The background code is as follows:    code as follows: object[] arg=e.commandargument.tostring (). Split (', '); Note the single quotes   string arg0=arg[0]. ToString ();  string arg1=arg[1]. ToString ();    Method 2, put the LinkButton control in the item template. This is more commonly used, you do this control plus the onclick event. The following table code is:    code as follows: LinkButton lbt= (LinkButton) sender;  object[] ARG=LBT. CommandArgument.ToString.split (', ');  string arg0=arg[0]. ToString ();  string arg1=arg[1]. ToString ();    Second, the use of hyperlinks to pass values, but also a common method   foreground code:  code as follows: <a href= "default.aspx?id=<% #Eval (" dict_id ")%>&type= <% #Eval ("Dict_type")%> "> Skip to Default.aspx page </a>    background:  code as follows: String strdict_id = request.querystring["dict_id"];  string strdict_type= request.querystring["Dict_type"];   

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.