For creating list view web part programmatically please check this link.
we have a Master list were the master data like Types, Departments this kind of value are stored.
As we are using custom list view webpart and using lookup filed for this data.
Now our problem is removing link of the lookup fields because it will redirect the user to that master list which we don’t want.
We are also using some other lookup fields which are referring to the title of some other list like contact name or company details etc... But we have to keep that link.
So simple problem statement is
1) remove link from lookup field
2) But keep link of lookup which are mapped with LinktoTitle.
We found that if you are selecting any look up field then other then LinktoTitle then your lookup URL will have something like this.
So we can find out that if Link contain RootFolder=* then it is referring to the lookup.
To removing this, what we had done is that something unethical.
We don’t know whether this is correct way or not.
We resolve this problem from java script.
In java script we find all the Anchor element of the document.
Then check the index of href attributes “RootFolder=*” so that we came to know that in this page this field is lookup field.
Just call this java script on the page where you want to remove the link of lookup.
You can use content editor webpart also.
Here is the java script to remove the lookup links.
Check it and let us know that it is working for you guys,
We have not done it for LinkToTile lookup link because the problem with RootFolder=* is that it will not redirect back to this page while LinkToTitle will redirect to the same page from where you traverse.