this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...
Tuesday, December 18, 2012
Windows 8 application development requirement
Monday, October 1, 2012
Add Event/Appointment in Google Calendar with Google account credential.
Friday, September 7, 2012
Html.RenderPartial() Sytanx Error : No overload for method 'Write' takes 0 arguments
Hey Everyone,
I was trying Html.RenderPartial() in Asp.net MVC and what I got “No overload for method 'Write' takes 0 arguments“
From my code it seems very clear that I have written correct syntax but actually there is a little problem with it.
My earlier code was is as below
@foreach (var p in Model.Members)
{
@{ Html.RenderPartial("MemberSummary",m); }
}
But it was giving me Error : “No overload for method 'Write' takes 0 arguments”. As we all know RenderPartial() directly writes in the output stream so it was better for using it than Partial().
After close look inside of code, I found that it should be C# statement and I was mixing inside of code block and I corrected out my code as below. It worked.
@foreach (var p in Model.Members)
{
Html.RenderPartial("MemberSummary", m);
}
Have a happy debugging !!
Monday, July 30, 2012
Windows Mobile 7.5 on my view.
Monday, July 2, 2012
Green field / Brown field development
In software development we are usually have two types of work to be done in any application. Both some legacy system is already running and we should require build on new system on it or build new system from very scratch.
When we are going to build new system without considering any of the old system and it does not connect with any other system such type of development referred as Green Field development
In contrast some system does not require depending on any other system, we can go ahead with development from scratch, we don’t rely on any other system such type of development referred as Brown Field Development.
Both type of development have their advantage and disadvantage on development.
Green Field:
Advantage
We have more control at the time of development,
We don’t rely on sub system.
We are free to stretch system as we need
Disadvantage
No reference is available, new system should build carefully meet all requirement of business.
Brown Field:
Advantage
Have reference of already running system
Can take advantage of existing data for future expansion
Can leverage system incorporate with new System.
Disadvantage
Hard to implement programming semantics at some level due to bound with old system.
We do many application but we might not know what type of development we do? Hope this will help us identifying our development.
Wednesday, June 6, 2012
Print button is not working in Crystal report viewer
Tuesday, June 5, 2012
Change default time out of strongly typed dataset table adapter command.
Public Sub SetCustomCommandTimeout()
Utility.SetCommandTimeout(CommandCollection)
End Sub
End Class
If (commands IsNot Nothing) Then
If (timeout < 0) Then timeout = GetConfigTimeout()
For Each cmd As System.Data.SqlClient.SqlCommand In commands
cmd.CommandTimeout = timeout
Next
End If
End Sub
Private Shared Function GetConfigTimeout() As Integer
Dim timeOut As Integer
If Not System.Configuration.ConfigurationManager.AppSettings("CommandExecutionTimeOut") Is Nothing Then
timeOut = CType(System.Configuration.ConfigurationManager.AppSettings("CommandExecutionTimeOut"), Integer)
Else
timeOut = 0
End If
Return timeOut
End Function
Tuesday, May 1, 2012
Do not serialize public property or field in a class
Wednesday, February 22, 2012
Programmatically create folder in SharePoint Document library with client object model
SharePoint 2010 has very strong client object library, with the help of client object model we can almost interact with all document related functionality from our application and can interact with SharePoint 2010.
Below is some code snippet for creating new folder in the SharePoint Document Library.
public bool CreateSPFolder(string libname, string correspondance)
{
bool bolReturn = false;
ClientContext ctx = this.GetSPClientContext();
Web web = ctx.Web;
List documentLib = ctx.Web.Lists.GetByTitle(libname);
string targetFolderUrl = libname + "/" + correspondance;
Folder folder = web.GetFolderByServerRelativeUrl(targetFolderUrl);
ctx.Load(folder);
bool exists = false;
try
{
ctx.ExecuteQuery();
exists = true;
}
catch (Exception ex)
{
bolReturn = false;
}
if (!exists)
{
ContentTypeCollection listContentTypes = documentLib.ContentTypes;
ctx.Load(listContentTypes, types => types.Include
(type => type.Id, type => type.Name,
type => type.Parent));
var result = ctx.LoadQuery(listContentTypes.Where
(c => c.Name == "Folder"));
ctx.ExecuteQuery();
ContentType folderContentType = result.FirstOrDefault();
ListItemCreationInformation newItemInfo = new ListItemCreationInformation();
newItemInfo.UnderlyingObjectType = FileSystemObjectType.Folder;
newItemInfo.LeafName = correspondance;
ListItem newListItem = documentLib.AddItem(newItemInfo);
newListItem["ContentTypeId"] = folderContentType.Id.ToString();
newListItem["Title"] = correspondance;
newListItem.Update();
ctx.Load(documentLib);
ctx.ExecuteQuery();
bolReturn = true;
}
return bolReturn;
}
Monday, January 23, 2012
Fix issue HTTP/1.1 200 OK Server: Microsoft-IIS/7.5 Error with a SharePoint 2010 Web Application
Generally, such error comes when we try to browse web-application url. There could be many problems around this problem and depends on it there are different solution for it.
First most common issue around this is that, web application does not contain any site collection at web application root level url, to resolve this you can create site collection from central admin ->Application Management ->Create Site Collection. During creation of site collection, please select your web application where you would like to create.
Second scenario, if you have already site collection created and still this problem occurs. To overcome such problem you have choice to restart IIS, reattach your content database, check services on your pc whether “work station” service is started.
Hope this will help!!
Thursday, January 12, 2012
Prerequisites could not be found for bootstrapping (while upgrading from VS 2005, 2008 to VS 2010)
When you try to add prerequisites, you will be surprised that it will not find your older version any more. Many forums said that Microsoft has disabled it and you need to upgrade to higher version of prerequisites.
You can see that in the given below images that shows unavailability.

To resolve this issue you need to copy boots trapper files.
Older version of VS files can be found at
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages
You need to copy files from above location to below location and once you copy required folders, you will be able to access those in prerequisites.
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages
Cheers!!
Wednesday, January 11, 2012
Adding Footer to SharePoint 2010 Custom Master Page
When you are going to develop custom layout of your SharePoint site, it could be requirement of having footer in the page. V4 master page does not contain any options to set footer in page.
You need to add footer manually to your custom master page.
If you check your master page you will find below line
Just above that line you can add your custom footer section as below sample markup.
Copyright © 2012 Company. All Rights Reserved.
Style for above div
*Customized foooter */
#s4-customfooter{
clear: both;
padding: 10px;
color: #ffffff;
background-color: #4F5E85;
}
Hope this will help!!
Thursday, January 5, 2012
The Project Item "module1" cannot be deployed through a Feature with Farm Scope
You might have faced such error sometime during your deployment of SharePoint projects. Usually this error comes due to lack of availability of particular item in the scope. You have limited items that can be deployed in the scope of web, site, web application and farm level.
Microsoft has prepared a very nice article to list out it. You can check out here
Monday, December 26, 2011
OOB: Change master page from SharePoint 2010
Most of time we don’t prefer to use conventional user interface provided by SharePoint when we configure it. We want our separate identity when we try to publish our site on base of SharePoint framework.
When you try to find out Changing of master page in your SharePoint, you may not get that options in your Site Settings, first you need to do is to Enable “SharePoint Server Publishing Features”.
To enable above features follow below steps..
Go to Site SettingsàSite Collection Administration à Site Collection Features à Activate SharePoint Server Publishing Features.
Now you may able to see Master pages menu in the Site setting under Look and Feel depends on the version you have installed on your machine.
Alternatively you can directly go to change master page with _layouts/ChangeSiteMasterPage.aspx , just add below url with your site and you will be redirected to change master page for your site.
How to get public key token for my dll or exe?
Sometime we need to find our dll or exe’s public token when we have strongly signed out. There is a very nice tool given by .net is sn.exe
Just go to command prompt of visual studio, and type following command. Here please note that you need to set your application folder path where your dll or exe assembly is stored.
Sn – T abc.dll
This will give us public token of abc.dll like below message
Public key token is c8903c1b3f99ec16
Wednesday, December 14, 2011
Install SharePoint 2010 on windows 7 64 bit
Most of time in case of development It would require to install sharepoint on the non-server os, As we know sharepoint 2010 can only be installed on the 64bit operating system. Now we have one choice to create environment on the Windows 7 64bit os.
If we don’t dig more on it, we have choice to install as standalone sharepoint but instead of that we would like to have sharepoint farm configuration and we don’t wish to install SQL express by Sharepoint installation but we have our own SQL server then?
Also to enable installation on Windows 7, we require changing in configuration file and that is to add one setting for it.
Below things require to add at ..\files\Setup\Config.xml
If you don’t add above setting, setup will give you error and you won’t be go further.
Next thing for using your own SQL server installation is to create Sharepoint Configuration database and that can be done with help of Powershell command named SP-NewConfiguationDatabase
Once you use above command in the powershell you will be asked to enter required details for your server and database creation.
To use above command please note that, you are going to use your windows user in it, so you need to give full qualified name.
Like mypc\user, if you don’t give full name it will give you error.
Reference:
http://msdn.microsoft.com/en-us/library/ee554869.aspx -for Installing Sharepoint
http://technet.microsoft.com/en-us/library/ff607838.aspx -for configuration database creation.
http://spdeveloper.net/2010/06/errors-when-installing-sharepoint-2010-in-windows-7-development-environment/ --for possible error we could have in creating configuration database.
Wednesday, November 30, 2011
How to Resolve Activate disabled Sandbox solution in SharePoint 2010
This problem mainly occurs when you start to develop sandbox solution and upload you solution to fresh SharePoint farm, if you have already developed some sandbox solution and some admin is maintaining SharePoint farm, you may never come to such problem.
Situation was, I was able to add solution to my site and I was also able to see SharePoint WSP and all was looking great, but when I was going to activate it, it didn’t seem to work and it was showing me user right tooltip, which usually comes up when we have not enough permission to access anything.

I wonder about my permission and I doubled check my permission but there was not an issue, then after checking about other problem if there could be.. but nothing was there.
After google, I found that there was issue of service named “Microsoft SharePoint Foundation Sandboxed Code Service” required to start prior to activating any sandboxed solution. This service can be activated from Central admin ->System Settings ->Server -> Manage Service on Server-> Start Service Microsoft SharePoint Foundation Sandboxed Code Service start
Reference: I found that useful information here
Connected WebParts in SharePoint 2010
SharePoint has very cool features of connected Web Parts, It simply means that two different web parts are connected and they can share data between them.
In Connected Web Parts there are basically two things required at least, one is Consumer Web Parts and Provider Web Parts. Consumer Web Parts gets data from Provider Web Parts, and this data passing is usually done with use of interface.
Connected web parts are best when we have two different web parts and we want to change web parts activity based on external events happen in another web part exist in the same web page.
Here, MSDN contains very nice walk through for creating connected web parts.
In above article, two attributes plays role for connecting web parts
ConnectionProvider: It should be attached to any one method which returns data, it does not necessary that it must have some value specified in the bracket, what so ever you write there will be displayed when you access web parts from SharePoint site.
ConnectionConsumer It should be attached to any one method which gets data from another web part.
NOTE: when you use this connected web parts in Web Part page added in sharepoint, you will have option to connect with consumer web parts. But in case of default page you may require to turn to edit mode of your page and then click on edit of web part and then you will have this options of connecting to another consumer web part.
In above scenario it is assumed that firstly we have added both consumer and provider web parts in the page and then we will have option to connect web parts.
Tuesday, November 29, 2011
Thoughts on Web Parts in SharePoint 2010
SharePoint 2010 has many inbuilt functionality and features. One can leverage on it and take advantage of out of box SharePoint development. But business is all about having information in the right way and at a certain moment easy to catch.
Most of case Web parts serve many business needs for showing up information in the customized forms when SharePoint out of box development does not provide enough information.
At the time of Web Parts creation in SharePoint 2010, one has two choices Visual Web Parts and Standard Web Parts.
Both of these are much useful on their way and most of asp.net developers are much familiar with Standard Web Parts because it is very much similar to that of asp.net developers. Visual Web parts allows developer to just drag and drop control as they do in most of asp.net pages, you will have availability of all standard web controls, you don’t need to take care of setting underlying properties of controls. On the other hand Standard web parts allows developer to set each and every property at run time, you can have more controls on each controls. You can create as many controls as you need; you can dispose your control when you don’t need it.
There can be debate of using Standard Web Parts and Visual Web Parts, but certainly it depends on the choice of developer and business nature. Sometimes it is noted that Standard Web parts gives good performance compared to Visual Web Parts, and at the same time you need to take care of many things when you develop Standard Web Parts compared to Visual Web Parts.
It is good that now developer has choice to choose which type of web parts they want to develop, in earlier developer has to create user control and then they can add that visual element in standard web parts, but now they can directly add visual elements with use of Visual Web Parts.
To take decision of using any web parts is based on the time and resource it requires and also many other parameters need to consider for business activity.
Monday, November 28, 2011
Connect office 365 SharePoint online with SharePoint client object model
When you create any SharePoint client object model application there are choices to connect with SharePoint either in LAN or SharePoint server. But now days there are much hype in office 365 provided by Microsoft, it does allow SharePoint online. You don’t need to manage your own SharePoint server if your organization is not much big and many companies are planning to move their work to office 365.
So it’s naturally necessary that your client object model should support this office 365 SharePoint online connection. Here there is a trick to connect with it, it’s not direct way to connect with SharePoint online. You need to consider many things for it like cookies and your id, password etc.
Here, it is very nicely explained how to authenticate with office 365 and make connection to SharePoint online with client object model.