http://example.com/ {variable_a}> page_name_a.aspx
http://example.com/ {variable_b}> page_name_a.aspx
我想打开一些网址。我已经设定了一条路线没有问题。但是,如果我想打开以下页面:
http://example.com/wireless-mouse>使用{variable_a}路线(产品)打开页面
http://example.com/voip-services>使用{variable_b}路线(服务)打开页面
按钮Click 事件,用于variable_a:
protected void product_Click(object sender, EventArgs e)
{
LinkButton gtproduct = sender as LinkButton;
RepeaterItem ritem = gtproduct.NamingContainer as RepeaterItem;
if (ritem != null)
{
Response.RedirectToRoute("products", new{variable_a = "wireless-mouse"});
}
}
变量_b的按钮点击事件:
protected void service_Click(object sender, EventArgs e)
{
LinkButton gtservice = sender as LinkButton;
RepeaterItem ritem = gtservice.NamingContainer as RepeaterItem;
if (ritem != null)
{
Response.RedirectToRoute("services", new{variable_b = "voip-services"});
}
}
它总是打开第一条路线{variable_a}。因此,我需要重定向到产品列表的页面路线{variable_a}或服务的页面路线{variable_b}。
这只是一个示例,我知道该示例的所有补办项目将显示同一页面。只要有可能就尝试做。