Use:
string url = UIContextHelper.GetElementUrl(moduleName, ElementName, displayTitle, objectId);
The moduleName shoule be the CodeName of your Module where you defined the UI for the object listing.
ElementName is the codeName of the UI element where the listing is.
ObjectId allows for a paramter to be passed.
If your listing uses additional parameters then you can pass them in by adding paramters to the Url:
string redirectToUrl = UIContextHelper.GetElementUrl(MyCustomModule.MODULE_NAME, "ShipmentProperties", false, ShipmentID);
if (mOrderId > 0)
{
URLHelper.AddParameterToUrl(redirectToUrl, "orderid", mOrderId.ToString());
}
if (mCustomerId > 0)
{
URLHelper.AddParameterToUrl(redirectToUrl, "customerid", mCustomerId.ToString());
}
URLHelper.Redirect(redirectToUrl);
EDIT: I just noticed that the code above is a bit wrong since URLHelper.AddParamter(redirectToUrl, "orderid", mOrderId.ToString()) returns a string with the new parameter added and hence you should replace 'redirectUrl' with this new value ie. redirectUrl = URLHelper.AddParamter(redirectToUrl, "orderid", mOrderId.ToString())