Tuesday, January 30, 2018

User Control Viewer

using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace UserControlViewer
{
    [ToolboxItemAttribute(false)]
    public class UserControlViewer : Microsoft.SharePoint.WebPartPages.WebPart
    {
        private Control _childControl = null;
        private string _userControlVirtualPath = "/_controltemplates/Sample.ascx";
        private string _errMessage = string.Empty;

         [Personalizable(), Category("User Control Path"), DefaultValue(""),
          WebBrowsable(true),WebDescription("User Control Virtual Path"),
          WebDisplayName("User Control Virtual Path")]
        public string UserControlVirtualPath
        {
            get { return _userControlVirtualPath; }
            set { _userControlVirtualPath = value; }
        }

        public UserControlViewer()
        {

        }

        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            if (_userControlVirtualPath != string.Empty)
            {
                if (_childControl != null) return;
                _childControl = Page.LoadControl(_userControlVirtualPath);
                if (_childControl != null)
                    Controls.AddAt(0, _childControl);
            }
        }

        protected override void RenderWebPart(HtmlTextWriter output)
        {
            if (_errMessage != string.Empty) output.Write(_errMessage);
            if (_userControlVirtualPath != string.Empty ||
                _userControlVirtualPath.Equals("") == false)
                RenderChildren(output);
        }

        protected override void RenderChildren(HtmlTextWriter output)
        {
            try
            {
                this.EnsureChildControls();
                if (this._childControl != null)
                    this._childControl.RenderControl(output);
            }
            catch (Exception ex)
            {
                _errMessage = string.Format(
                  "Exception Message (RenderWebPart) = {0}
", ex.Message);
            }
        }

        public override void Dispose()
        {

        }
         
    }
}

Wednesday, June 3, 2015

SharePoint Site Template Builder Helper

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint.Publishing;
using System.Web.UI.WebControls.WebParts;

namespace SPHelper
{
    class Helper
    {
        public static void AddLibrary(SPWeb web, string libraryname, string description, string docTemplateName, string listTemplateName)
        {
            web.AllowUnsafeUpdates = true;
         
            SPDocTemplateCollection docColl = web.DocTemplates;
            SPDocTemplate WebpartPagetemplate = null;
         
            SPListTemplateCollection tem = web.ListTemplates;
            SPListTemplate lstTemplate = null;
         
            foreach (SPDocTemplate doctemplate in docColl)
            {
                if (doctemplate.Name.Equals(docTemplateName))
                {
                    WebpartPagetemplate = doctemplate;
                }
            }
         
            foreach (SPListTemplate template in tem)
            {
                if (template.Name.Equals(listTemplateName))
                {
                    lstTemplate = template;
                }
            }
         
            web.Lists.Add(libraryname, description, lstTemplate, WebpartPagetemplate);
            web.Update();
        }

        public static void AddPage(SPWeb web, string pagename,string pagelayoutname)
        {
            PageLayout currPageLayout = null;
            web.AllowUnsafeUpdates = true;
            PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(web);
            string pageName = pagename;
            PageLayout[] pageLayouts = publishingWeb.GetAvailablePageLayouts();
            foreach (PageLayout pagelayout in pageLayouts)
            {
                if (pagelayout.Name.Equals(pagelayoutname))
                {
                    currPageLayout = pagelayout;
                }
            }
            PublishingPageCollection pages = publishingWeb.GetPublishingPages();
            PublishingPage newPage = pages.Add(pageName, currPageLayout);
            newPage.ListItem[FieldId.PublishingPageContent] = string.Empty;
            newPage.ListItem.Update();
            newPage.Update();
            newPage.CheckIn(string.Empty);
        }

        public static void AddWebPartToPage(SPWeb web, string pageurl, string ucpath, string wptitle, string zoneid, int zoneIndex)
        {
            using (SPLimitedWebPartManager wpManager = web.GetLimitedWebPartManager(pageurl, PersonalizationScope.Shared))
            {
                UserControlViewer.UserControlViewer webpart = new UserControlViewer.UserControlViewer();
                webpart.UserControlVirtualPath = ucpath;
                webpart.ZoneID = zoneid;
                webpart.Title = wptitle;
                wpManager.AddWebPart(webpart, zoneid, zoneIndex);
            }
        }

        public const string doctemplatename = "Web Part page";
        public const string listtemplatename = "Document Library";
        public const string pagelayout = "BlankWebPartPage.aspx";

           //Helper.AddLibrary(properties.Web, "Default", "Annonymouns Access files are available in this Library",Helper.doctemplatename,Helper.listtemplatename);
           //Helper.AddPage(properties.Web, "EURegister.aspx", Helper.pagelayout);
           //Helper.AddPage(properties.Web, "PeopleAwards.aspx", Helper.pagelayout);
           //Helper.AddPage(properties.Web, "NPOAwards.aspx", Helper.pagelayout);
           //Helper.AddPage(properties.Web, "RCIAwards.aspx", Helper.pagelayout);

    }
}

Saturday, March 16, 2013

SharePoint 2010 - Web Application Management


SharePoint Training – Web Application Management.
Introduction:
                SharePoint 2010 Central Administration Provides the Interface to Create Web Applications, Site Collections and to manage them. In this Article we’ll look at a brief on how to create and manage Web Applications and Site Collections in SharePoint Server Using Central Administration.
Terms:
  • Web Application: Web Application is a top level site in SharePoint Server hosted in IIS. Web Application behaves as a container for the Site Collections and Other Sub Sites. In other words Web Application hosts the Site Collections and sub sites in the SharePoint. SPWebApplication object represents a Web Application in SharePoint.
  • Site Collection: A site collection is a grouping of websites under a common top-level site that have the same owner and share administration settings, for example, permissions. When you create a site collection, a top-level site is automatically created in the site collection.
  • Sub Site: Sub Site is equivalent to a general asp.net site under a given Site Collection.  We can have ‘n’ number of Sub Sites for a give Site Collection. In general SPWeb object represents the current site (which can be a top-level site or a sub-site).
In this Article we’ll go through the steps for creating a Web Application, Site Collection and a Sub Site respectively.
Creating a Web Application:
  1. Go to Start -> All Programs -> Microsoft SharePoint 2010 Products -> SharePoint 2010 Central Administration.
  2. By clicking on SharePoint 2010 Central Administration. Central Administration Web Site is opened in the browser as shown below.
  3. The Central Administration Web Site allows the management of the following settings and services.
    1. Application Management.
    2. System Settings.
    3. Monitoring
    4. Backup and Restore
    5.  Security
    6. Upgrade and Monitoring
    7. General Application Settings
    8. Configuration Wizards.
  4. Application management section of Central Administration allows us to create and manage the Web Applications and Site Collections.
  5. Under Application Management Section of Central Administration, choose ‘Manage Web Applications’.

  1. On the Ribbon menu click on New Button which displays ‘Create New Web Application’ Window.
  1. Choose the following options in the window:
    1. Authentication-Mode: Classic Mode for Windows Authentication
                                                                 Claims Based for FBA Authentication.
    1. IIS Web Site: Create New/ Add to Existing ISS Web Site.  Specify the port number.
  1. Security Configuration: Choose - Negotiate (Kerberos).
  2. And similarly provide Application Pool and Database Name for the Web Application to be created.
  1. Under *Service Application Connections bind the required Service(s) for the Web Application.
  1. This completes the creation the Web Application in SharePoint.


Creating a Site Collection:
  1. Under Application Management section of Central Administration, click on ‘Create Site Collection’ option available in Site Collections section.
  2. Provide the following options in the opened window in order to create site collection.
    1. Choose Web Application:- Choose one Web Application from the available web applications dropdown list.
    2. Provide the Title and Description for the Site Collection.
    3. Provide the Web Site Address.
    4. Choose the Template from the list of available templates in the provided tabbed window.
    5. Provide Primary and Secondary Site Collection Administrator for the Site Collection.
    6. Choose the **Quota Template if required.
  3. Repeat the same steps in order to create other Site Collections under Same/Different Web Application.
  4. By now a Web Application and Site Collection has been created. Now we can browse the created Site Collection and we can create any number of Sub Sites in it.
Creating a Sub Site:
  1. Browse through the available Site Collection in SharePoint.
  2. Click on the Site Actions Ribbon of the SharePoint Site and from the dropdown list click on New Site option, which displays the create window.
  3. From the available templates choose ‘Team Site’ template and provide the title and description values. The more options button provides the option to have same set of permission or new set of Permissions for the sub site.
  4. The Following options are available in the Create window of a site:
    1. Title and Description.
    2. Web Site Address. URL to navigate through the crated sub site.
    3. Permissions. Use Unique Permissions Option provides to have new set of permissions for the created sub site.  Use Same Permissions options will inherit the Parent site permissions for the sub site.
    4. Navigation Inheritance. Provides the navigation options. One can display the parent navigation in current site or only current site navigation.
* Service Application Connections: SharePoint provides lot of services that provides most of the out of the box features of SharePoint. More information on SharePoint Application Services is available in the next article.
** Quota Templates: SharePoint allows the users to allot some kind of limitation on the usage of space for a particular Web Application. This functionality is achieved by using ‘Quota Templates’. More information on Quota templates is available in the article.
Now coming back to Web Application Management, as we have already created a Web Application, now we can go head and manage the available Web Applications using Central Administration site.
                Under the Application Management click on Manage web applications and then select a web application. Once the web application is selected the options are enabled in the ribbon.
The following are the options available for the web application.
a)      General Settings
b)      Manage Features
c)       Manage Paths
d)      Service Connections
e)      Authentication Providers
f)       Self-Service Site Creation
g)      Blocked File Types.
h)      User Permissions.
i)        Web part Security
j)        User Policy, Anonymous Policy and Permission Policy.
General Settings:
                The General Setting tab has the following options:
1.    General Settings.
2.    Resource Throttling.
3.    Workflow.
4.    Outgoing E-Mail settings.
5.    Mobile Account.
6.    SharePoint Designer.

1. General Settings: The following Screen Shots shows the available options in the general settings.





The following window shows the blocked file types where we can mention the file type extension which we can prevent from uploading to the server.




Thursday, January 31, 2013

direction service




<script type="text/javascript">

    var map; var drds = []; var drdds = []; var rqs = [];

    window.onload = function () {

        var chicago = new google.maps.LatLng(41.850033, -87.6500523);

        var mapOptions = {

            zoom: 7,

            mapTypeId: google.maps.MapTypeId.ROADMAP,

            center: chicago

        }

        map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);

        var ltlgn = ["Hyderabad", "Mumabai", "Pune", "Shirdi", "Bangalore"];



        for (var i = 0; i < ltlgn.length; i++) {

            var request = {

                origin: ltlgn[i],

                destination: ltlgn[i + 1],

                travelMode: google.maps.DirectionsTravelMode.DRIVING

            };

            rqs.push(request);

        }

        for (var i = 0; i < 3; i++) {

            var directionsDisplay = directionsDisplay + i;

            directionsDisplay = new google.maps.DirectionsRenderer();

            directionsDisplay.setMap(map);

            drds.push(directionsDisplay);

            var directionsService = directionsService + i;

            directionsService = new google.maps.DirectionsService();

            drdds.push(directionsService);

            setTimeout(d(i), 2000)

        }

    }

    function d(i) {

        drdds[i].route(rqs[i], function (response, status) {

            if (status == google.maps.DirectionsStatus.OK) {

                drds[i].setDirections(response);

            }

        });

    }



</script>

<div id=""></div>



Thursday, July 12, 2012

What does my blog says about me?

It' been really long time that i have posted something on my blogger. Recently i  have come across some kind of  interesting stuff across the web saying

What does my blog says about me?

After reading i have tried the same thing for my blog and i have found the following results which i am posting here...! and the link for the site is http://www.typealyzer.com.





Thursday, May 10, 2012

Javascript Tabs

The following Code is used to develop a Simple Tabbed Navigation Using Javascript:


       var tabs = ["tab1", "tab2", "tab3"];
       function showtab(e) {
            for (var i = 0; i < 3; i++) {
                    hide(tabs[i]);
            }
            for (var i = 0; i < 3; i++) {
                if (e == i) {
                    toggle(tabs[e]);
                }
            }
        }

Hide/Show a Div using Java Script


The following code is used to show/hide a div using JavaScript:

function toggle(e) {
            var x = document.getElementById(e);
            if (x.style.display == "none") {
                x.style.display = "block";
            }
            else {
                x.style.display = "none";
            }
}

Wednesday, April 25, 2012

Send Mail in asp.net using c#

Send Mail in asp.net using c#:

The following code snippet is used to send an email in asp.net using c#. The code itself is self explanatory. The comments in the code help you to understand the code.

Thursday, March 22, 2012

Overview of Embedded Development

Micro Processor and Micro Controller:

1.    Getting Started
                What do I need to know to get started with embedded development? Who should learn Embedded Development? Why should I learn Embedded Programming? These are quite simple and straight forward questions. Students, Professionals, hobbyists or anyone can learn embedded programming and there is no restriction. If you have an experience of high level programming, then u would be comfortable with the embedded development and don’t worry if you don’t even written any kind of computer program till date.

Friday, March 2, 2012

8051 (8 bit) Micro processer Instruction Set Reference:


8051 (8 bit) Micro processer  Instruction Set Reference:

Data Transfer    
Arithmetic
Branching
LOGICAL INSTRUCTIONS
MOV
 MVI
LDA
LDAX
LXI
LHLD
STA
STAX
SHLD
XCHG
SPHL
XTHL
PUSH
POP
OUT
IN
ADD
ADC
ADI
ACI
LXI
DAD
SUB
SBB
SUI
SBI
INR
INX
DCR
DCX
DAA
JC     RC
JNC  RNC
JP     RP
JM   RM
JZ     RZ
JNZ  RNZ
JPE  RPE
JPO RPO
CC   RET
CP
CM
CZ
CNZ
CPE
CPO

CMP
CPI
ANA
ANI
XRA
XRI
ORA
ORI
RLC
RRC
RAL
RAR
CMA
CMC
STC