Recently, we had a case where a customer required to have a link column which is generated on the base of other columns – in that case he wanted to pass the Title field as a parameter in a page. You can read the forum post here.
We further extended this request by generating not only web links but also images.
Everything is in the list settings
For our case, we are using a custom list. We have added three columns – New Window (of type Yes/No), URL (of type Calculated), and IMG (again of type Calculated).
The Title column is used to retrieve information about the specific parameter we want to pass into our URL and IMG columns.
The New Window column is used to determine if the generated web link in the URL column to be opened in a new window or not.
The URL and IMG columns are used for representing the generated link and image respectively.
The important part is to set a proper formula for calculating the URL and IMG column values.
For the URL, we set the following formula:
IF([New Window]=TRUE,"' target='_blank' ","'"),">",
In this case, we are generating a link to an image. We start with the web application and gallery (http://mywebapp/FeaturesGallery/) then adding the title column value, and then add the extension of the image.
IF([New Window]=TRUE clause checks if New Window column value is true, if so adds target='_blank', which opens the link in a new window.
For the IMG, we set the following formula:
Title,".png'"," width='","450px","' />")
Nothing special here. We just generate the img tag and set its width property to 450px.
Now, we simply enter a few rows onto our columns:
Note that you would just need to add the Title column value.
In the screenshot above, you see that the strings are not generated as web links or images.
Now, let’s display them as we require
Using the Infragistics Grid Web Part
We simply connect the Grid web part to our list, using the Data Source Picker dialog.
We leave all other settings as their default. Clicking the OK button would save the result and close the Grid Editor dialog.
Now, as a user, we can add new rows using the Add new row button at the top of the rows. Typing specific information, all other columns are generated as needed.
Clicking the Done button would append a new row in the SharePoint list.
Official NetAdvantage for SharePoint Web Site: http://www.infragistics.com/dotnet/netadvantage/sharepoint.aspx#Overview
Official NetAdvantage for SharePoint Samples: http://sharepoint.infragistics.com/