TreeView Checkbox Click on PostBack

Friday, May 7, 2010

The TreeView control admitted in ASP.Net 2.0 is lacking an option to cause a postback due to a user checking/unchecking a checkbox on a tree node.

It would of course be useful to add a bit more code so that the resulting event could specify which node was changed, etc.  But as of now you can just look at the "checkednodes" property of the tree.

 

Code Snippet
  1. using System;
  2. using System.Text;
  3. using System.Data;
  4. using ASP = System.Web.UI.WebControls;
  5. using System.Web.UI;
  6. using System.IO;
  7.  
  8. namespace myNameSpace
  9. {
  10.     class VerboseTreeView : ASP.TreeView, IPostBackEventHandler
  11.     {
  12.         public event EventHandler CheckClick;
  13.  
  14.          protected override void Render(HtmlTextWriter writer)
  15.         {
  16.             StringBuilder builder = new StringBuilder();
  17.  
  18.             using(StringWriter stringWriter = new StringWriter(builder))
  19.             {
  20.                 HtmlTextWriter tempWriter = new HtmlTextWriter(stringWriter);
  21.                 base.Render(tempWriter);
  22.             }
  23.  
  24.             string find = "<input type=\"checkbox\" ";
  25.             string replace = "<input type=\"checkbox\\cf2 " onClick=\"" + getPostBack() + "\\cf2 " ";
  26.  
  27.             writer.Write(builder.ToString().Replace(find, replace));
  28.         }
  29.  
  30.         protected string getPostBack()
  31.         {
  32.             return this.Page.GetPostBackEventReference(this, "@CheckPostBack");
  33.         }
  34.  
  35.         protected virtual void OnCheckClick(EventArgs e)
  36.         {
  37.             if (CheckClick != null) CheckClick(this, e);
  38.         }
  39.  
  40. void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
  41.         {
  42.             OnCheckClick(new EventArgs());
  43.         }
  44.  
  45.     }
  46. }
  47.  
  48. Be the first to rate this post
  49.  
  50.     * Currently 0/5 Stars.
  51.     * 1
  52.     * 2
  53.     * 3
  54.     * 4
  55.     * 5
  56.  
  57.     ShareThis
  58. Tags:
  59.        }

Posted by Rahul at 4:56 AM 0 comments  

Determining the Current User Context inside Sharepoint

Tuesday, May 4, 2010

What is the best way to determine the current user on a custom developed Web Part for MOSS 2007? I found four solutions so far, but I'm pretty sure there's more:

  1. Use System.Web.HttpContext.Current.User.Identity.Name, like in any ASP.Net web application
  2. Use System.Security.Principal.WindowsIdentity.GetCurrent().Name
  3. Have the Current User Filter send the current user to your web part, and (of course) make your web part a consumer of that value.
  4. SPWeb web = SPControl.GetContextWeb(Context); SPUser currentUser = web.CurrentUser;

Posted by Rahul at 2:55 AM 0 comments  

Safe mode processing and Safe Controls

Friday, April 30, 2010

Any custom page is analyzed using the safe mode processing. This analysis puts security. processing in safe mode ensures that there is no script online personalized page. In other words insurance does not allow on-line processing mode script because a hacker attack can be mounted on the command line. If you try to run scripts online personalized page.

will get error ‘Code blocks are not allowed in this file’.

In case you still want to run in-line script in customized pages you need to specify ‘AllowServerSideScript=true’ in the ‘SafeMode’ tag section in web.config file.

<SharePoint>
<SafeMode ... >
<PageParserPaths>
<PageParserPath
VirtualPath="/sites/MySite/SitePages/*"
IncludeSubFolders="true"
CompilationMode="Always"
AllowServerSideScript="true" />
</PageParserPaths>
</SafeMode>
</SharePoint>


Insurance will help us determine the controls that will control customized pages. pages as controls can only be defined in the web.config file on the 'SafeControls. For example, in the following snippet of code that have defined custom pages can use the controls' Microsoft.SharePoint.WebControls.



<SafeControls>
<SafeControl
Assembly="Microsoft.SharePoint"
Namespace="Microsoft.SharePoint.WebControls"
TypeName="*"
AllowRemoteDesigner="True" />
</SafeControls>

Posted by Rahul at 4:54 AM 0 comments  

Concept of virtual path provider?

Friday, April 23, 2010

Any project has three parts three is the standard and common part and the other is the customized version. In ASP.NET they have three types of pages for any project three is common ASPX pages and the other is customized ASPX pages. Common pages are stored on file directories while customized versions of pages are stored in content database.

So in other words, we need an abstract mechanism by which we can make the content pages of SQL Server database and virtual directories. This is accomplished through virtual provider provided by SharePoint. So for every page reads custom virtual provider of database content and the same thing happens with the ASP.NET runtime. Common for all pages goes to the directory, parses it and passes it in the ASP.NET runtime.

share

virtual provider is an abstraction that loads the page from the bottom or the file system depending on whether or common custom pages and so with the ASP.NET runtime.

share

Posted by Rahul at 5:24 AM 0 comments  

Installing the SharePoint Services

Saturday, April 17, 2010

Although SharePoint Services are designed to be easy to use, it is a bit of a task of installing and fixing the initial server configuration. Fortunately, this is a work at once. To begin, you must first download the Microsoft SharePoint Services. You can get http://www.microsoft.com/windowsserver2003/technologies/sharepoint/default.mspx SharePoint Services download is a 34 MB self extracting, executable file.

To install SharePoint Services, download the file STSV2.EXE to an empty folder and double click it. This will cause Windows to decompress the contents of the file and start the setup program. When the installation wizard starts, accept the license agreement and click Next to continue. The next screen prompts you to perform a typical installation or if you prefer to create a server farm. For demonstration purposes, select the Typical installation option and click Next. Setup will now confirm that you are about to install the SharePoint Services and the destination drive has enough free space. Click the Install button to begin installing the necessary files

As the installation progresses, you might notice a message indicating that Setup is the configuration of Microsoft SQL Desktop Engine. Windows SharePoint Services rely on SQL Server. As we all know, however, SQL Server can be expensive. To help make the services of SharePoint (and other applications) more affordable, Microsoft has included a watered down version of SQL Server in Windows Server 2003. It is called Microsoft SQL Desktop Engine or MSDE. If no SQL Server installed on the server before you install Windows SharePoint Services, the installation program automatically configures SharePoint Services to use MSDE. Although it works well enough MSDE, SQL Server provides much better performance in environments where more than five people will be using the Windows SharePoint Services at the same time.

Posted by Rahul at 11:37 PM 0 comments  

Editing and Customizing Windows SharePoint Services Sites, versions 2.0 or prior

Saturday, April 10, 2010

Microsoft Office FrontPage 2003 is a web editor that is fully integrated with Windows SharePoint Services 2.0. FrontPage 2003 offers a variety of WYSIWYG tools you can use to customize and manage SharePoint sites, including a device improved table editing and a collection of dynamic templates for SharePoint sites. With FrontPage 2003, you can modify and control the components of SharePoint site (for example, team sites, Web Parts, or navigation) and customize the look and feel of a SharePoint site. You can also use FrontPage 2003 to prepare reports analyzing the use of SharePoint sites, so you can control who is using your site and how they are using. To edit Web pages in a SharePoint site, you must be a member of a site group with the Add and customize pages right on the SharePoint site.

With FrontPage 2003, you can use Windows SharePoint Services and Web Parts to create data-driven Web sites. Web Parts are reusable modular pieces of code that can easily be added to SharePoint sites. With some web development skills, you can use FrontPage 2003 to create Web Parts that connect to live data from a variety of sources. For example, to add the company's current sales data to your SharePoint site, you can use FrontPage 2003 to create a Web Part that is linked to your company's sales database.

Posted by Rahul at 4:45 AM 0 comments  

Here are some key features of "Admin Report Kit for SharePoint 2003

Tuesday, March 30, 2010

Quick Reports: Provides several right out-of-the box reports based on SharePoint objects and its native hierarchy. Select a report, specify the URL and run the desired report. You can now export or print the report. It's that simple
Power Reports: A productivity tool for power administrators to generate reports about ever-changing information in SharePoint sites and lists. Requisite options to specify report criteria, entities to be reported, automatically export, print, and schedule the desired reports with minimum human intervention. You can now share the reports with the respective team members through e-mail or publish them to a SharePoint library
Custom Reports: Customize reports from the available built-in reports, select the properties you want to view and save them as report templates for repetitive use
Export Report: Flexible Export feature to export reports from ARKSP to MS-Access database / XML / HTML / Comma Separated Values (CSV) file format. Data exportable into MS-Access database for archival purposes or import into Microsoft Excel (from CSV) for further analysis
Publish Report: Publish reports to a document library and share the reports with the respective users
Preview and Print Report: Flexible print preview and print options to print the reports from ARKSP to any local/network printer
Filter data: Powerful Filter options to track and report only the desired information across different logical entities
Hierarchical View: Provides a coherent intuitive view of configuration information of Virtual Servers, Portal Sites, Site Collection, Webs, Portal Areas and Lists

Requirements:

  • Processor: Intel Pentium processor
  • Disk space & Memory: 512 MB RAM and minimum of 15 MB of free disk space
  • oftware: Microsoft SharePoint Portal Server 2003 (or) Windows SharePoint Services v2.0 with latest Service Pack
  • Microsoft Data Access Components (MDAC) v2.8 only

Limitations:

  • 15 days trial period
  • some features are disabled in the trial version

Posted by Rahul at 9:36 PM 0 comments  

Website Updates