Created
May 29, 2018 23:36
-
-
Save WildGenie/bfe41f1fd49cf18c095758c5f9b567f8 to your computer and use it in GitHub Desktop.
Web Form Routes Örnek
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="altkategori.aspx.cs" Inherits="altkategori" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
</head> | |
<body> | |
<form id="form1" runat="server"> | |
<div> | |
<h1> | |
ID: | |
<asp:Literal ID="ID" | |
Text="<%$RouteValue:id%>" | |
runat="server"> | |
</asp:Literal>, | |
<asp:Literal ID="IDKod" | |
runat="server"> | |
</asp:Literal> | |
</h1> | |
</div> | |
</form> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Web.UI; | |
public partial class altkategori : Page | |
{ | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
if (Page.RouteData.Values["id"] == null) | |
{ | |
IDKod.Text = "ID Yok"; | |
} | |
else | |
{ | |
IDKod.Text = Page.RouteData.Values["id"].ToString(); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Application Language="C#" %> | |
<%@ Import Namespace="System.Web.Routing" %> | |
<script RunAt="server"> | |
private void Application_Start(object sender, EventArgs e) | |
{ | |
// Code that runs on application startup | |
RegisterRoutes(RouteTable.Routes); | |
} | |
private void RegisterRoutes(RouteCollection routes) | |
{ | |
routes.MapPageRoute(string.Empty, "altkategori/id/{id}", "~/altkategori.aspx"); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment