Asp.net web form url route usage summary, asp. netroute
Use URL routing in asp.net web form.
I. Foreground controls use RoutingGenerate a url address using an expression. Note that the route parameter is assigned a value to prevent other route expression values from being used.
Method 1:
<Asp: HyperLink ID = "hlSupply" NavigateUrl = '<% $ RouteUrl: routename = TechSupplySearch, areacode =, techfield = %>'
Runat = "server"> technology supply </asp: HyperLink>
Method 2:
<A href = "<% = GetRouteUrl (" MemberSearch ", new {membertype =" commp any ", areacode =" ", industrycode =" ", pageindex = ""}) %> "> Technology Enterprises </a>
Used in data binding on the control interface
<Asp: Repeater ID = "myGrid" ViewStateMode = "Disabled" runat = "server">
<ItemTemplate>
<Li> <a target = "_ blank" href = '<% # this. getRouteUrl ("TechSupplyView", new {id = Eval ("SupplyId")}) %> '> <% # Eval ("SupplyName ") %> </a> <span> <% # string. isNullOrEmpty (Eval ("cityname "). toString ())? "& Nbsp": Eval ("cityname") %> </span> <% # Eval ("hightech") %> </span> </li>
</ItemTemplate>
</Asp: Repeater>
Url routing pagination control: urlpager
Ii. Use routing in the server background code
1. Global. asax file:
Void Application_Start (object sender, EventArgs e)
{
// Code that runs when the application starts
RegisterRoutes (RouteTable. Routes );
}
// Register url Routing
Void RegisterRoutes (RouteCollection routes)
{
Routes. routeExistingFiles = false; // by default, URLs that are not routed to the same physical path, such as http: // localhost/MyFolder/MyPage. the advantage of aspx is that static resource files are not routed. Otherwise, static files such as js and css may trigger Page_Load events multiple times.
// Routes. Ignore ("{resource}. axd/{* pathinfo}"); // the routing of static resource files is not valid in this way.
// Routes. Ignore ("{path}/{name).jpg"); // the routing of static resource files is not valid in this way.
// Register a route
Routes. MapPageRoute ("TechNewsSearch", "TechNews/{pageindex }","~ /NewsInfo/TechNewsSearch. aspx ", true, new RouteValueDictionary {" pageindex "," 1 "}}, new RouteValueDictionary {" pageindex ", @" \ d {1 ,}"}});
Routes. MapPageRoute ("TechSupplySearch", "Supply/{areacode}/{techfield}/{pageindex }","~ /TechSupply/TechSupplySearch. aspx ", true, new RouteValueDictionary {" areacode "," 0 "},{" techfield "," 0 "},{" pageindex "," 1 "}}, new RouteValueDictionary {"pageindex", @ "\ d {1 ,}"}});
Routes. MapPageRoute ("MemberSearch", "Members/{membertype}/{areacode}/{industrycode}/{pageindex }","~ /Member/MemberSearch. aspx ", true, new RouteValueDictionary {" membertype "," 0 "},{" areacode "," 0 "},{" industrycode "," 0 "}, {"pageindex", "1" }}, new RouteValueDictionary {"pageindex", @ "\ d {1 ,}"}});
}
2. Use WebForm in background code
Obtain and change route parameter values
RouteValue = Page. RouteData. Values ["techfield"] = null? String. Empty: Page. RouteData. Values ["techfield"]. ToString (); // obtain route Parameters
Page. RouteData. Values ["areacode"] = selOrgan. SelectedValue; // modify route Parameters
Page. RouteData. Values. Remove ("Over"); // Remove route Parameters
Generate a route address in the background code
NewUrl = this. GetRouteUrl ("MemberSearch", Page. RouteData. Values );
Implementation of webpage client jump Routing
Response. RedirectToRoute ("TechSupplySearch", Page. RouteData. Values );
Response. RedirectToRoutePermanent ("TechSupplySearch", Page. RouteData. Values );
How to design a pop-up form in aspnet (webform)
Basic Introduction:
ShowModalDialog () (IE 4 + supported)
ShowModelessDialog () (IE 5 + supported)
The window. showModalDialog () method is used to create a modal dialog box that displays HTML content.
The window. showModelessDialog () method is used to create a non-modal dialog box that displays HTML content.
Usage:
VReturnValue = window. showModalDialog (sURL [, vArguments] [, sFeatures])
VReturnValue = window. showModelessDialog (sURL [, vArguments] [, sFeatures])
Parameter description:
SURL -- required parameter; Type: String. Specifies the URL of the document to be displayed in the dialog box.
VArguments -- optional parameter; Type: variant. Used to pass parameters to the dialog box. The passed parameter types are not limited, including arrays. Dialog Box passed
Window. dialogArguments to get the passed parameters.
SFeatures -- optional parameter; Type: String. Used to describe the appearance and other information of the dialog box. You can use one or more of the following, separated by semicolons.
----------------
1. dialogHeight: dialog box height, not smaller than 100px
2. dialogWidth: Dialog Box width.
3. dialogLeft: the distance from the left of the screen.
4. dialogTop: the distance from the screen.
5. center: {yes | no | 1 | 0}: whether to center. The default value is yes, but the height and width can still be specified.
6. help: {yes | no | 1 | 0}: whether to display the help button. The default value is yes.
7. resizable: {yes | no | 1 | 0} [IE5 +]: whether the size can be changed. No by default.
8. status: {yes | no | 1 | 0} [IE5 +]: whether to display the status bar. The default value is yes [Modeless] or no [Modal].
9. scroll: {yes | no | 1 | 0 | on | off}: whether to display the scroll bar. The default value is yes.
The following attributes are used in HTA and are not used in general web pages.
10. dialogHide: {yes | no | 1 | 0 | on | off}: whether the dialog box is hidden when printing or previewing. The default value is no.
11. edge: {sunken | raised}: Specify the border style of the dialog box. The default value is raised.
12. unadorned: {yes | no | 1 | 0 | on | off}: no by default.
Parameter transfer:
1. vArguments is used to pass Parameters in the dialog box. There is no limit on the type. For words... the remaining full text>
How to Implement the drop-down menu in the webForm of aspnet in c # Language
Use Menu Control