Sunday, December 11, 2016

A lightweight shopping cart web application in ASP.NET MVC 5

http://bacaj.azurewebsites.net/a-lightweight-shopping-cart-web-application-in-asp-net-mvc-5/

git code: https://github.com/lbacaj/OpenOrderFramework

Thursday, December 4, 2014

C# When to use if else and when to use ternary operator



If you have any control flow, then use if else

int a = 1;
int b = 3;

// Use negated expression.
if (!(a == 1 && b == 2))
{
//Do some thing..
   Console.WriteLine(true);
}

// Use binary or version.
if (a != 1 || b != 2)
{//Do some thing..
   Console.WriteLine(true);
}


If you have any condition, based on condition if you want to assign any value then use ternary operator

Ex:
int input = Convert.ToInt32(Console.ReadLine());
string classify;
classify = (input < 0) ? "negative" : "positive";

Advantages of using ADO.NET

• All data in ADO.NET is transported in XML format
• ADO.NET can improve overall development time
• ADO.NET supports a variety of development needs
• ADO.NET can be used from all programming languages that target the .NET Framework

Tuesday, December 2, 2014

Error in Web parts after SharePoint platform upgrade



Using MOSS 2007 web part code, i have re build the VS 2010 SharePoint project. After deploying the webpart, i was getting error.

Solution:
I have added below tag in web.config

SafeControl Assembly="MyCustomWebpart, Version=12.0.0.0, Culture=neutral, PublicKeyToken=bdb4a6220fe9433c” Namespace="MyProject.UI.WebParts” TypeName="ListItemReport" Safe="True" SafeAgainstScript="True"

SharePoint remove and repair the broken Web Part



Some times, you will see some webparts shows error, but will not able to delete that web parts.
Using below url, you will able to delete the webparts.

http://SPO/default.aspx?contents=1

You will see all error-ed webparts, select webpart and delete.

Error occurred in deployment step 'Activate Features': Cannot start service SPUserCodeV4 on computer


Root Cause: Microsoft SharePoint Foundation Sandboxed Code Service is stopped.
Solution:
Open Central Administration site
go to System Settings
lick on Manage Service on server
Check to see if Microsoft SharePoint Foundation Sandboxed Code Service  is running, it should be stopped
Start the service and try deploying the Sandboxed solution

Monday, December 1, 2014

Migrate MOSS 2007 Custom webpart to SharePoint 2010


First Get MOSS 2007 code.

Open VS 2010
Create new Empty SharePoint Project.
Add New webpart.
Now delete .cs from solution.
Right click on Web part folder Add existing item.
Select .cs file from old MOSS 2007 code folder.
Save.
Build.
Resolve all references and errors.
Deploy...


Loading...