Quantcast
Channel: HTML – Random Technical Thoughts
Browsing latest articles
Browse All 18 View Live

Image may be NSFW.
Clik here to view.

Run app as a specific user

Running an application as a specific user is common practice, but sometimes it’s helps to debug your application if you can run it as a specific user. This does not change security context which the...

View Article



Image may be NSFW.
Clik here to view.

Clear Controls on screen

Here is a method that will clear all the controls on your screen (as long as it matches one of the controls in the method).  It recursively calls itself until all the controls are clear. Here is an...

View Article

Image may be NSFW.
Clik here to view.

How to add a required field validator to a SharePoint web part.

You just have to set the ID property of the control, then set the control to validate to the ID of the control. Below is an example //Declare Controls private TextBox _txtFirstName = new TextBox();...

View Article

Image may be NSFW.
Clik here to view.

Programmatically set url field on list

I had to find a way to programmatically add items to list that has a url field. Here is an example of how to do it. When you set the field that is an URL you have specify a url a coma (and a space) and...

View Article

Image may be NSFW.
Clik here to view.

How to cache data in a SharePoint web part

Here is some sample code to cache a list of strings in a web part. List<String> documentNames = new List<String>(); object cacheddocumentNames = PartCacheRead(Storage.Shared,...

View Article


Image may be NSFW.
Clik here to view.

Detect who the current user in a SharePoint web part

It’s easy to detect who the current authenticated in ASP.HET (HttpContext.Current.User), but that doesn’t work in a web part. So in a web part, you need to open a web and then you access the current...

View Article

Image may be NSFW.
Clik here to view.

How to create sub sites in SharePoint 2007

Here is some code to create a subsite in SharePoint. The important part to remember is to set AllUnsafeUpdates (and unset), otherwise it won’t work. try { SPWeb webSite = SPContext.Current.Web;...

View Article

Image may be NSFW.
Clik here to view.

Method to strip out special characters from a string.

Special characters can cause all kind of trouble. So here is a method that you pass in a string and all the special characters will be removed.   public static string StripSpecialCharacters(string...

View Article


Image may be NSFW.
Clik here to view.

How to add a content editor web part to a SharePoint page

Here is some code to add a content editor web part to a page. So if you are creating a page in code (like during feature activation), then you put a content editor web part on the page. Setting the...

View Article


Image may be NSFW.
Clik here to view.

How to create a new site based on a custom site template

Here is a method to create a sub site based on a custom site template.  You need to pass in your new site name and the name of the site template.  It will check the available site templates for the one...

View Article
Browsing latest articles
Browse All 18 View Live




Latest Images