Hi nedash,
I have created sample, refer the below code.
HTML
Default.aspx
<h1>
Home</h1>
<hr />
<a href='<%=ResolveUrl("~/Customers") %>'>View Customers</a></form>
Customers.aspx
<h1>
Customers</h1>
<hr />
<ul>
<asp:Repeater ID="rptCustomers" runat="server">
<ItemTemplate>
<li><a href='Customers/<%#Eval("Id")%>' target="_blank">
<%#Eval("Name")%>
</a></li>
</ItemTemplate>
</asp:Repeater>
</ul>
CustomerDetails.aspx
<h1>
Customer Details</h1>
<hr />
<b>Customer Id:</b>
<asp:Label ID="lblCustomerId" runat="server" />
Code
Customers.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id", typeof(int)),
new DataColumn("Name", typeof(string)),
new DataColumn("Country",typeof(string)) });
dt.Rows.Add(1, "John Hammond", "United States");
dt.Rows.Add(2, "Mudassar Khan", "India");
dt.Rows.Add(3, "Suzanne Mathews", "France");
dt.Rows.Add(4, "Robert Schidner", "Russia");
rptCustomers.DataSource = dt;
rptCustomers.DataBind();
}
}
CustomerDetails.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
lblCustomerId.Text = this.Page.RouteData.Values["CustomerId"].ToString();
}
}
Global.asax
<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>
<script RunAt="server">
void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("Customers", "Customers", "~/Customers.aspx");
routes.MapPageRoute("CustomerDetails", "Customers/{CustomerId}", "~/CustomerDetails.aspx");
}
</script>
Screenshot