In my topic where I reused the view inside another main view, the problem occurred on an Action link, because we added the list views of contact and
opportunity in the model view of Account, therefore when you see the edit, detail,
delete or even Create hyperlink, you would see that it is pointing to the
Account view itself which is not the right thing, it should redirect to the contact
and opportunity views, like below screenshot
Means, you are inside the account detail page and if you
mouse over the edit,
detail, delete or even Create hyperlink then you would see the Account/Edit/2,
see above red highlighted area. Now, we should also fix this by overwriting the
Action Link, Link should be “/Contacts/Edit/2”. For this fix, created a class
of URLs and added a static method like below one
public class URLs
{
public static string ContactDetail(int ContactId,string Type)
{
string URL = string.Empty;
if (Type == "Edit")
URL = "/Contacts/Edit/" +
ContactId.ToString();
else if (Type == "Details")
URL = "/Contacts/Details/" +
ContactId.ToString();
else if (Type == "Delete")
URL = "/Contacts/Delete/" +
ContactId.ToString();
return URL;
}
}
|
Above code shows how we overwrite the Edit, Detail and
Delete URL, now this method called inside the list views of contact, a similar method
can be made for an opportunity to replace the Action Link
Above screenshot is the combination of 2 pictures, the right side is the top view code which shows how we use the URLs class and
overwrite the CREATE ACTION LINK and left side of the picture shows how we
overwrite the detail, edit and delete action link.