Wednesday, February 10, 2010

Adding Silverlight application(.xap file) in sharepoint web part.

Import the System.Web.UI.SilverlightControls to use the silverlight control.

Create the object of Silverlight control and specify the path of .xap file. Add this control in web part.

Silverlight silverlightControl = new Silverlight();
silverlightControl.ID = "DemoId";
silverlightControl.Source = "~/_layouts/1033/Demo.xap";
silverlightControl.Width = Unit.Percentage(100);
silverlightControl.Height = new Unit(400);
silverlightControl.AutoUpgrade = true;

this.Controls.Add(silverlightControl);

Monday, February 8, 2010

Bind dropdown list with sharepoint choice column as data source programmatically

Easy way to populate the dropdown list with databind option instead of looping the items in list for Choice column.

private void FillDropDownList(SPList list , DropDownList drpList , string columnName)
{
try
{
SPFieldChoice field = (SPFieldChoice)list.Fields[columnName];
drpList.DataSource = field.Choices;
drpList.DataBind();
}
catch (Exception ex)
{}
}

Thursday, January 28, 2010

TFS : The solution you have opened is under source control but not currently configured for integrated source control in Visual Studio

At some point you opened a solution offline, and this caused the associated server to be marked offline. The messagebox you are seeing is due to a bug with opening solutions from Source Control Explorer while the server is marked offline. The bug should be addressed in VS 2008 Service Pack 1.

The fix/workaround for your issue is to mark your server online again by taking a solution online. You should see a Go Online option in Solution Explorer (right-click menu or toolbar button). Use that to take your solution online. After that you should be able to open solutions from Source Control Explorer again without issue.

The fact that taking a solution offline also marks the server offline is catching some of our users offguard.

Debugger error : The debugger stopped execution of code on the Web site. This caused IIS to assume that the worker process.



To continue to debug, you must configure IIS to allow the worker process to continue. This error message does not appear with versions of IIS that are older than IIS 7.


To configure IIS to allow the worker process to continue

  1. Open the Administrative Tools window.

    1. Click Start, and then choose Control Panel.

    2. In Control Panel, choose Switch to Classic View, if necessary, and then double-click Administrative Tools.

  2. In the Administrative Tools window, double-click Internet Information Services (IIS) Manager.

    IIS Manager opens.

  3. In the Connections pane, expand the <computer name> node if necessary.

  4. Under the <computer name> node, right-click Application Pools.

  5. In the Application Pools list, right-click the name of the pool your application runs in, and then click Advanced Settings.

  6. In the Advanced Settings dialog box, locate the Process Model section, and perform one of the following actions:

    • Set Ping Enabled to False.

    • Set Ping Maximum Response Time to a value that is larger than 90 seconds.

    Setting Ping Enabled to False stops IIS from checking whether the worker process is still running and keeps the worker process alive until you stop your debugged process. Setting Ping Maximum Response Time to a large value allows IIS to continue monitoring the worker process.

  7. Click OK to close the Advanced Settings dialog box.

  8. Close IIS Manager and the Administrative Tools window.

Installation of Moss on Windows Server 2008 : Compatibilityi issue

We should install MOSS with SP1 on Windows Server 2008 environment to avoid the compatibility.

Access denied while updating web objects.

We get Access denied even if the code is running under 'RunWithElevatedPrivileges' and AllowUnsafeUpdates is set to True.

Solution :
Instead of using RunWithElevatedPrivileges command , create a instance of SPSite with system account user token.

SPSite currentSite = SPContext.Current.Site;

using(SPSite _oSite = new SPSite(currentSite.ID, urrentSite.SystemAccount.UserToken))
{
// Do something
}