I am not sure if this behaviour is normal. I guess i have to investigate it another time. If you develop a listform using Visual Studio and based on an application page like i wrote in some other posts about it, you might notice, that in the edit and new form the save and cancel button does not work. They just do not firing the event.
The solution to this is really easy. In the schema file or by using code you change the listform url and also make the setting “UseLegacyForm” to true.
<form Type="NewForm" Url="NewForm.aspx" SetupPath="features\$SharePoint.Feature.DeploymentPath$\List1\NewSP.aspx" UseLegacyForm="TRUE" WebPartZoneID="Main"></form>
Doing so makes the save and cancel button working again, but now you have another stupid behaviour. Look at the screen: It is a generic / custom list as template, but it also shows buttons for edit series, claim release, distribution approval. What the hell is going on here?
Short Info: If you like to use a different column as LinkToItem or ListItemMenu (like the Title column) and you wanna configure it in your visual studio solution in the schema.xml i would like to give you the important hint to achieve this.
In the view there are viewfields. This Fieldref need the attributes and should look like this:
<FieldRef Name=”MyDifferentColumn” ListItemMenu=”TRUE” linkToItem=”true”></FieldRef>
Important note: the linkToItem is case sensitive. It starts with a small “l” – If not i won’t work!
..:: I LIKE SHAREPOINT ::..
Well i a custom list form you always have a cancel and a save button. I already posted how to create & deploy custom list forms. But i didn’t mentioned that it is possible to override the save handler. That’s pretty useful if you want to do some extra action after the user clicks on the save button, or if you need to write some data of the form to an external system.
Well my other post are here:
Part 1: Setting up a solution with a list definition, a list instance and deploy it.
Part 2: Creating a custom list form and connect it with the list definition.
Part 3: Necessary settings for custom listform in Visual Studio
Cause i didn’t told you how to overwrite the save button in order to do some custom actions on this part i’ll do it now. It’s really simple. See the code below:
//In your aspx page a control like this should be available
<sharepoint:savebutton runat="server" ControlMode="New" ID="savebutton" ></sharepoint:savebutton>
//Override Save Button in the init method
protected override void OnInit(EventArgs e)
//In the init method you overrite the event handler for saving with your save button action
SPContext.Current.FormContext.OnSaveHandler += new EventHandler(mySaveHandler);
//My Save Button Function
protected void mySaveHandler(object sender, EventArgs e)
//you can validate the page if you like
//Do whatever you wanna do
SPListItem currentItem = SPContext.Current.ListItem;
That’s it. Really easy right?
..:: I LIKE SHAREPOINT ::..
SharePoint Designer offers the possibility to create datasource which can be linked in order to display a merged or combined view of the data sources. It’s a pretty cool function in order to create list views – but it was more comfortable with the SharePoint Designer with Preview. Anyway, this post covers a small example of those linked data source.
So in this post i want to give an example of how to deal with that. In creation time, we will come a point where the following question has to be answered that’s why i put it first;
Merge or Join?
Using linked data sources gives you two options: Merging or joining. But what is the difference? You should read this great post.
A merge is an interesting thing if your data sources have exactly the same columns – so you can sort, order or group on the data.
A join is useful if your lists or data sources are completely different but they have one column to combine (like Product ID) at least.
Well, after that let’s do some work. Let’s think about an easy scenario. Ok, we have two tasks lists. We want to see all tasks from both lists. (more…)