by Christoph Keller
25. January 2011 13:49
If you have multiple MVC 2 Routes, check carefully the route order! If a less specific rule comes first, it will be threated first.
For an example, I have a Language-Navigation Route:
routes.MapRoute(
"Language_Switch",
"language/{language}",
new { controller = "Language", action = "Index"...
[More]
by Christoph Keller
11. January 2011 16:27
If you render a Link to another Controller / View, you can just use the method 'Html.ActionLink' on a view:
Html.ActionLink("Link Title", "TargetAction", "TargetController");
Now, if you want to submit additional parameters / action parameters in the link, you can use the overloads of 'Html.Ac...
[More]
by Christoph Keller
11. January 2011 13:20
Usualy a MVC 2 Page is rendered using a Controller which loads a Model and supplies the data to the configured View which displays the data.
Sometimes it is required to render more than one View (or render multiple Partial Views) at one output Page. This mostly makes sense in MasterPages (for examp...
[More]
by Christoph Keller
11. January 2011 13:04
If you want to display a IEnumerable<x> List in a View, you cannot use standard ASP.NET WebForms Controls like a ListView to iterate over a list. The reason here is mostly because of the fact that MVC 2 does not implement the Form-ViewState.
Now if you need to do this, you can just iterate ov...
[More]
by Christoph Keller
3. January 2011 15:22
Here is a small snippet to get a TermSet out of the Managed Metadata Service from SharePoint 2010:
string siteUrl = "http://SITEURL";
using (SPSite localSite = new SPSite(siteUrl))
{
// Create Taxonomy Session
TaxonomySession taxSession = new TaxonomySession(localSite);
// Get the 'Mana...
[More]
by Christoph Keller
3. January 2011 14:41
Here is a super article, describing the Dialog Framework in SharePoint 2010. It also gives a perfect how-to for a sample dialog.
http://www.chaholl.com/archive/2010/11/17/using-the-dialog-framework-in-sharepoint-2010.aspx
by Christoph Keller
3. January 2011 14:26
Because of the fact that the SharePoint way of changing the userprofile propery order is a pain, here is the coding-way doing this task:
string siteUrl = "http://SITEURL";
using (SPSite localSite = new SPSite(siteUrl))
{
SPServiceContext serviceContext = SPServiceContext.GetContext(localSit...
[More]
by Christoph Keller
3. January 2011 14:17
To get the configured Display Value of a Field in a SPListItem, use the following Code:
new SPFieldLookupValue(SelectedListItem["FIELDNAME"] as String).LookupValue
Another way would be:
SelectedListItem.GetFormattedValue("FIELDNAME")
The second snipped displays also a hyperlink to item in the lo...
[More]