Monday, June 1, 2015

Sharepoint Visual WebPart - Cannot find web project item in design view

I was creating a Visual Webpart sometimes back and suddenly all the ascx controls started throwing the following error in design mode in visual studio 2012: "Cannot find web project item in design view  '~/sites/Site1/SubSite1A/SubSite1AB/VisualWebPart/VisualWebPart.ascx'."

My Environment was:

  1. SharePoint 2010
  2. Visual Studio 2012
  3. Visual WebPart project

Issue was not that big but impact was very big because I was not able to see controls in design mode. I have got the pointer from the url mentioned in error. Initially my project was created for root site and site url was: "~/sites/Site1/" and later I have changed the site url for my project to "~/sites/Site1/SubSite1A/SubSite1AB".
Changing the URL was the culprit for showing this issue, because changing the site url in "project setting" is not changing its original value stored at element in projectName.csproj file:


If you are getting the same issue then change back site url to its original url as per your    or change the url value in  in .csproj file  for element to make it work...After changing the site url back to original,Save project and restart your visual studio.

Enjoy Green Coding

Friday, July 19, 2013

Sharepoint Master Pages

I have seen that most of the time, sharepoint professionals are facing hard time to deal with master page and branding in sharepoint. So, I have decided to write easy ways to deal with master pages. Here is my first blog over sharepoint branding. Please do the following steps to create a master page from existing:

1. Open the site into windows explorer

2. copy and paste a master page in masterPages folder. Rename the copied one.

3. copy and rename css file from style folder(see the css path in master page's html)

4. copy all the images and paste into a new image folder(see the image path in master page's html). Change the images according to your branding.

5. change the image folder's in image's source in master page's html

6. Save checkin

7. publish

Now your Master page is ready to use.

Go to the site properties and click on master page under look and feel section. select your master page for "site master page" and "system master page" .

Go back to home page of your website, you will have a new look according to your master page.

Happy Green Coding !!!

Sunday, May 19, 2013

Which one is my future: ASP Web form, MVC, HTML5, or WebAPI for Web Architect/Developer?


Why client-side techniques such as JQuery, Knockout, HTML5, etc.are becoming so popular? They all are  having one thing in common: usage of WebAPI.
Nowadays not only the simple websites, but also big enterprise level applications are using WebAPI to designs their high traffic websites. I was a part of a design and development team of a Airport site, it was designed and developed in SharePoint 2010. It was having 50% custom code and most of them were having webparts. each webpart was getting the data from Database(I will not disclose the name of DB). Data retrial and transactions all were done using the webAPI.
I have gone through a very good article by a co-founder of DNN Shaun Walker, he has explained the future of web development in microsoft technologies, like Asp.net. Please go through this blog and see what exactly changes he is planning for the DNN using this wave of change in Microsoft technology.

Microsoft Declares the Future of ASP.NET is Web API


Enjoy your green coding and try to use more code4green.com to generate more plants on this earth.
Try to use handmade bags to bring your home goods in daily life, it will really make a big change in environment.


Sunday, July 22, 2012

Important Law's of Computer or IT Industry


Parkinson’s Laws: 

1st law:
"Work expands to fill the time available"
or
"Data expands to fill the space available for storage."
 2nd law:
Expenditures rise to meet income

Wirth's law:

 "Software gets slower faster than hardware gets faster".

Moore's law

(Intel's co-founder Gordon Moore) the number of transistors on integrated circuits doubles approximately every two years. The period often quoted as "18 months" According to "2010 update to the International Technology" Roadmap for Semiconductors has growth slowing at the end of 2013, and after 2013 "time transistor counts and densities" are to double only every 3 years not 18 months


Last but not least, a very important rule for project management: You can't control what you can't measure.

Tuesday, June 26, 2012

How to Use VSS in Visual Studio 2010?

I have been asked this question many times, so I thought I can write down a blog on this topic.
Question: How can I use VSS(not TFS) in Visual studio 2010?
Solution: Please follow these steps to use VSS in Visual Studio 2010:
Step-1. Go to Tool and Option





Step-2.In Option select Source Control(see 2.1 in image). Then Select VSS from dropdown Source Control PlugIn. Click OK.




Step-3. In VS2010, open a solution. Right click on solution(3.1) and then select "Add solution to source control".(see 3.2 in image).



























Step-4. Select database for sourcesafe and it will add the solution in VSS


















I hope it will help you. Enjoy green coding at www.code4green.com

Wednesday, May 23, 2012

Enum comparison Sample

Here is the sample for using enum for comparison with numeric value. See the highlighted lines for using a enum comparison in switch case:
you can use this aspx page's code behind file to test in your aspx page, for this you have to make the following changes Inherits in aspx page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPage.aspx.cs" Inherits="Code4Green.FreeCodeGenerationTool.TestPage" %>


SAMPLE

 
using System;
using System.Web.UI.HtmlControls;

namespace Code4Green.FreeCodeGenerationTool
{
    public partial class TestPage : System.Web.UI.Page
    {
        public enum FilterByDoctorType
        {
            General,
            Dental,
            Orthopadic,
            ENT,
            Cancer
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.Controls.Add(CreateDoctorContextControls(0,111011));
                this.Controls.Add(CreateDoctorContextControls(1, 111011));
                this.Controls.Add(CreateDoctorContextControls(2, 111011));
                this.Controls.Add(CreateDoctorContextControls(3, 111011));
                this.Controls.Add(CreateDoctorContextControls(4, 111011));
            }
        }

        private HtmlGenericControl CreateDoctorContextControls(int filterByValue, int doctorId)
        {
            HtmlGenericControl htmlStudentListItemControl = new HtmlGenericControl();

            switch (filterByValue)
            {
                case ((int)FilterByDoctorType.General):
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"General Physician. "); break;
                case ((int)FilterByDoctorType.Dental):
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"Dental Surgon. "); break;
                case ((int)FilterByDoctorType.ENT):
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"ENT Specialist. "); break;
                case ((int)FilterByDoctorType.Orthopadic):
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"Orthopadic surgon. "); break;
                case ((int)FilterByDoctorType.Cancer):
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"Cancer Specialist. "); break;
                default:
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"General Physician"); break;
            }

            return htmlStudentListItemControl;
        }

        private HtmlGenericControl CreateYourWebControl(int doctorId,string yourText)
        {
            HtmlGenericControl divControl = new HtmlGenericControl("div");

            HtmlGenericControl hyperlinkControl = new HtmlGenericControl("a");
            hyperlinkControl.Attributes.Add("href", "http://www.code4green.com");
            hyperlinkControl.Attributes.Add("class", "yourCSS.Class");
            hyperlinkControl.Attributes.Add("title", "Plant a free tree by using code4green website");
            hyperlinkControl.InnerText = "goto code4green website";

            HtmlGenericControl spanControl = new HtmlGenericControl("span");
            spanControl.Attributes.Add("class", "MySpanClass");
            spanControl.InnerText =yourText;
           
            divControl.Controls.Add(spanControl);
            divControl.Controls.Add(hyperlinkControl);
           
            return divControl;
        }
   }
}


Wednesday, April 25, 2012

SkyDrive War - MS, Google, and DropBox

Are you ready for SkyDrive war? Google has launched GoogleDrive(same as MS's SkyDrive) too. Now there are three major player in the market(cloud based market). Microsoft, Google, and DropBox. The major difference is data storage. Microsoft is giving 25GB+unlimited MS office docs+unlimited photos, while Google is just giving 5 GB space(for extra space you have to pay  $2.49 per month for 25 GB).
Another big difference is declaimer. Google declaimer is saying that google will have rights on your documents, while Microsoft and Dropbox are not claiming your documents.
If you are already a member of existing SkyDrive users than go to SkyDrive website and claim your free 25 GB.
Here you can see the comparison between cloud based storage drives
Compare SkyDrive
Generate Green Code Using Code4Green.com