Get Id from Url from Plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
Hi,

Simply; i'm writing a plugin that displays a tab on the product page in the admin menu.
When i go to the newly created tab, i can call my Action without any problem.

My only problem is, I want to get the Id from the Url but I don't know how, does anybody know please?

I.e if the Url is:
http://admin-demo.nopcommerce.com/Admin/Product/Edit/4

I want to get the 4.

I read somewhere about RouteData.Value but there doesn't seem to be a method called value.  I tried Request.Querystring, but that's not a valid.

Does anybody know?

Thanks in advance
9 years ago
var productId = Convert.ToInt32(System.Web.HttpContext.Current.Request.RequestContext.RouteData.Values["ID"]);
9 years ago
Thanks for the reply.  I will try this when i get home tonight (after work) and let you know.

Thanks again.
9 years ago
Brilliant, thanks it worked.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.