【发布时间】:2012-11-08 06:47:13
【问题描述】:
我正在我的网站中使用 URL 重写。
我可以使用
重写网址Response.RedirectToRoute("bills-show");
但是如何从我的 GridView 重定向到另一个页面?
目前我在GridViewRowDataBound 中使用以下代码。
e.Row.Attributes.Add("onclick", "location='CallCenter/BillDetails.aspx?billNo=" + e.Row.Cells[0].Text + "'");
但我需要的是使用 URL 重写。
我尝试过使用
e.Row.Attributes.Add("onclick", "WriteUrl(" + e.Row.Cells[0].Text + ")"); // in GridViewRowDataBound.
和
protected string WriteUrl(string billNo)
{
return pg.GetRouteUrl("bill-details", new { billno = billNo });
}
但这不起作用!!!
你能帮帮我吗???
【问题讨论】:
-
你的新网址会是什么样子?
-
website.com/orders/127这里127是billNo
标签: c# asp.net gridview url-rewriting