Browse by Tags

All Tags » ASP.NET (RSS)

How to: Use LINQ to SQL without using the Object Relational Designer

LINQ to SQL has already proved to be extremely easy to use to create object relational mappings when you have an existing database schema using the Object Relational Designer. This designer is good, but you may not want something that is autogenerating Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

How to: Hack a Class Library Project into a Web Application Project

Kind of a weird tip here, but I have ran into a situation where I have needed to do this. Basically, I have had an existing class library (for SharePoint development) and for some reason, I have decided I need to add ASP.NET file types to it (i.e. User Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Mutex Mischief

To clean up an old farm from some setup errors, I recently rebuilt the farm from bare metal, re-attaching all the content DB's after the rebuild to prevent data loss.  Imagine my horror when after 100% successful testing, and flawless installation, the first page I pull up shows this: Mutex could not be created. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Mutex could not be created. After some research I learned that this is an ASP.Net issue that occasionally crops up when an app pool identity (ie the Web App Service Account in SharePoint) is not a local administrator.  When setting the identity, access to the Windows Registry key where the IIS Mutex Key is kept is supposed to be granted (obviously not an issue for local admins).  If it does not have access to read this key, the above error is generated.  To add it, you have to modify the key and grant permissions for you identity account(s) to read that key, then close all Mutex Threads (or just reboot the server). A big thanx to Jerry Orman who documented this issue and the fix here: http://blogs.msdn.com/jorman/archive/2006/07/24/system-invalidoperationexception-mutex-could-not-be-created.aspx As a side note to any trying to implement least-permission security on a locked down server, make sure your...
Posted by SharePoint Blogs
Filed under: ,

SPSqlDataSource: This control does not allow connection strings with the following keywords: ‘Integrated Security’, ‘Trusted_Connection’.

I ran into this one again lately when deploying. We are folowing best practices with our connection strings by using Integrated Security. We have several controls on the web site making use of SqlDataSource controls. However, at runtime, we are left when Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under: ,

Image Changes on Hover

It sees there are a lot of large javascript samples out there to change an image source on mouse over, but they all seem overly complex.  Here's a little one I made recently for a project I was working on: <script> function imgHover(imgObj,imgSrc){     imgObj.src=imgObj.getAttribute(imgSrc); } </script> And here's some HTML to demonstrate how to use it: <img     src=" /PublishingImages/main.jpg"     out=" /PublishingImages/main.jpg"     over=" /PublishingImages/main_01.jpg"     onmouseover="java-script:imgHover(this,'over');"     onmouseout="java-script:imgHover(this,'out');"     alt=""     border=0 /> Change the "java-script" and remove the "-" to make it work... It won't show up on the blog post otherwise (it tries to run it).  I've found it easiest to just embed the script in the master page, then I can use img tag with the extra attributes on any page in my site I want... Posted on SharePoint Blogs Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under: , ,

Security Trimming WebControls and ASP Objects

I hadn't used this yet, and had cause to this week.  It works slick, and is pretty configurable... I used it to hide the SiteActions button on list pages for members, but not admins, as well as admin web parts embedded in a page.  It works with Web Parts, Web Controls, and other ASP.Net objects (ie. SharePoint:*, etc.).  Wrap the content you want trimmed in the following code (using SPD): <Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="BrowseDirectories"> [Content to Trim] </Sharepoint:SPSecurityTrimmedControl> You can then swap out the "BrowseDirectories" with whatever you need for the trimming.  Here are the one's I've found handy so far: BrowseDirectories = Anyone but Limited Read (Anonymous is Limited Read) ManageWeb = Site Collection Admins ManageSubwebs = Site Owners AddListItems = Site Members and specified list contributors Here's a link to all the defined values in the SPBasePermissions Enum . Posted on SharePoint Blogs Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under: ,

Yahoo! Weather Web Part

Yeah, I know. You’re thinking this is frivolous; “What’s the point?”, you say. Well this is my first web part and I decided to go with something a little less “high profile”. However, I am still happy with it and think Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under: ,

Adding category titles to Blog sites (category.aspx)

I recently found an application of the Blog template that was a great fit, but needed the Category title listed on the top of the page when you click a category from the default page.  Normally, it is not visible anywhere except in the URL as a parameter, and in the categories of the posts listed.  The primary content of the page is displayed by a ListViewWebPart embedded in a table in the aspx file.  It starts like this: <table cellpadding=0 cellspacing=0 style="padding: 5px 10px 10px 10px;">            <tr>             <td valign=top>                 <WebPartPages:WebPartZone runat="server" FrameType="TitleBarOnly" ID="Left" Title="loc:Left"><ZoneTemplate> <WebPartPages:ListViewWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{973762DE-3C5C-47B0-B80C-895B16BEDD6E}" > <WebPart xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns=" http://schemas.microsoft.com/WebPart/v2" >   <Title>Posts</Title>   <FrameType>None</FrameType>   <Description>Use the Posts list for posts in this blog.</Description>...
Posted by SharePoint Blogs
Filed under: , ,

Web part custom property - dropdown list

It isn't immediately obvious how to include a drop down list as a custom property on a web part. To do this you simply use an enum. Eg. //create enum public enum ProductByEnum {ByType = 0, ByBrand, ByChemistry}; //create get/set for the property protected Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under: ,

Creating XHTML compliant ASP.Net server controls

ASP.Net is great but many of the controls use table tags when they render. I am currently in the process of developing some Internet sites using MOSS 2007 which need to meet accessibility guidelines so these controls, in their out of the box state, are Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under: , ,

Excellent post about making SharePoint xhtml compliant

For anyone using the web content management components of MOSS 2007 to produce Internet sites this is essential reading. SharePoint uses a lot of ASP.Net controls which render using tables and non compliant html. To get rid of this there are a few things Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under: ,

An efficient way to set web control values

Rather than setting the widths of label and textbox controls individually like this: oLabel1.Width=150; oLabel2.Width=150; oLabel3.Width=150; It is much more efficient to add the controls to the controls collection and use: foreach(Control oControl in Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under:

Setting custom properties on web parts

When creating web parts it is often useful to allow users to supply some additional parameters to the web part. This can be done by adding custom attributes which can then be set by the user and used in your code. To do this use the following syntax: Read More......( read more ) Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks
Posted by SharePoint Blogs
Filed under: ,

SharePoint Connections - The Real Day 3

Well, today was already scheduled to be a short day, but between a VPC failure (seems to be a common theme... a few presenters also has this issue) and some issues back in the office, it looks like I'll probably miss the rest of the day. It solves one challenge... Which presentation to go to at the end. Unfortunately, whoever scheduled the presentations set 3 or 4 really good presenters and topics all against each other, so the choice was tough... I was leaning toward either Dustin's Data Part Deep Dive, or AC's Internet WCM, but Neil Iversen had a really good looking topic (MOSS PowerShell) that he teased us with earlier in his Advanced Features presentation, and Veli-Matti Vanamo had one that looked tempting called Branding your site with Site Definitions and Features. I did get a chance to catch Todd Baginski's BDC presentation though, as well as Neil Iversen's SharePoint Mobile presentation. Here's my notes for both: When using the BDC, you cannot authenticate with FBA. This will cause issues with the BDC - Todd mentioned that he thought he remebers hearing/reading someone say they found a way around this, but couldn't find it later. Also, when you index the BDC and rows are pulled for a search query, the action hyperlinked to the search result is the "default" action created by the system when you created the BDC Application. You can modify the default to have the behavior you'd like on search results. There are two commonly used...

SharePoint Connections - The Real Day 2

I started off by trying out Veli-Matti Vanamo's Introduction to Web Part Development presentation. He was actually a substitute for his co-worker, Emer McKenna. The majority of the content was from their new book to be released in Dec, Microsoft SharePoint 2007 Technologies: Planning, Design and Implementation . While the majority of the presentation was slide deck, there was still some good information to be had there. A few notes from this session I took were as follows: Web part management is almost identical between SharePoint and ASP.Net 2.0. The two primary differences are that in SharePoint, you can add the Microsoft.SharePoint.dll reference to get additional functionality, and when using SharePoint, the webpartmanager is overridden by the spwebpartmanager, to apply SharePoint specific details to the rendering. There are three acceptable types of web parts: The ASP.Net 2.0 Web part, which uses the System.Web.dll for it's inheritance, and is compatibility with both ASP.Net Web Part Zones, and SharePoint/WSS 3.0 Web Part Zones. These web parts are usually labeled with a .webpart extension. The WSS 2.0 web part, which uses the Microsoft.SharePoint.dll library for its inheritance, and is a deprecated method for creating web parts. The compatibility is still there for moving web parts from WSS 2.0 to WSS 3.0. These web parts have a .dwp extension. The Hybrid web part, which uses both the above mentioned dll libraries for inheritance, and is specific to WSS 3.0/MOSS....
Posted by SharePoint Blogs
More Posts Next page »