I had been customising Sharepoing theme lately in 2010 version, and i have to say it's not very fun, mainly due to lack of documentation online and a big change in UI elements comparing to version 2007.
Often times we have to customise SharePoint’s stock user interface, particularly elements such as edit block, toolbar, menus, etc. It’s possible to have our own custom items in these areas, but first it would be a lot easier to understand their names and locations respectively.
I have been playing around with LINQ in Sharepoint object model and I have to say I’m quite impressed. It does shorten the amount of code we write and works just as great or better.
A handy way to select distinct records from SPListItemCollection set queried from CAML query.
Sharepoint has a feature that allows us to migrate list data structure and content to a different site so that we do not have to re-create them. This is done through list settings -> save list as template. List template is a powerful function which can save the data structure of a list as well as its content.
Lately we found a very interesting fact of Sharepoint, which I think is worth writing a post about. Although it is very rare that someone will read directly into Sharepoint database to retrieve information, but for some hardcore users, especially with my last post regarding how Sharepoint stores data in backend database, one can easily read into Sharepoint Prod_Content database and do CRUD transactions.
I spent quite some time today fixing this problem of accessing a list item in parent web. What I had to do was to access a list item in a parent web, but it kept crashing as if there's no permission given to access it.
Time and time again, I use these methods in coding for Sharepoint. These include methods for querying a list, bind a Dropdown List to a list, and bind a Dropdown List to a multiple choice field.
This is an extremely useful function, which allows you to read an Excel spreadsheet and convert its data into a DataTable in C#. With data in a DataTable, we can perform lots of things to it.
When you group list items by some fields, by default Sharepoint have the items collapsed. It's quite annoying to have to manually expand each. There's a way you could easily expand all list items or collapse in one click.
I had the problem of saving files which I uploaded programatically to Sharepoint list item. When I tried to save them, there's pop up dialog saying the file is in read only mode, even I had all the required permissions.
Just two weeks ago, my website had been hacked and what drove me crazy was I couldn't find out what was wrong, or which files were been hacked. All I knew was the site had been marked as containing malicious code by Google and hence visitors could not get to my site, which in another words, my site was blocked by Google!
I was trying to add a duplicate link to the list item menu dropdown context box, so that user can click and duplicate an item. It's actually quite easy to do that.
I had the problem of page not able to redirect when in an ajax postback. It happens to be the fact that I disabled a line in web.config:. This line should be added in HttpModules, so that redirection will work in Ajax postback. This class manages HttpModules for Ajax functionalities in ASP.NET.
Today I was reading Google's Webmaster Guideline regarding content duplication on the Internet and steps that Google advise webmasters to take care if the situation applies. It's quite interesting as I did not know some of these facts.
I came across this problem of wanting to add a column in the List view web part (stock standard one) with the ability to have html elements rendered properly. Unfortunately Sharepoint's standard list view only displays text in it.
Lately I had fun digging into Sharepoint database and see how the monster was built and what its database schema looking like. Well, it's pretty smart the way it was built but it's also a pain for developers to understand and even to play with it, if they have to. With the business that I am working for, we have to create reports for corporates, which forces us to having to dig into Sharepoint database directly, even though I read a lot of posts saying that is not recommended by Microsoft.
A useful function to send email in Sharepoint, programatically.
The release of Sharepoint 2007 really helped Microsoft stepping a big step forward into the Intranet market in recent years, but what's predicted coming up bigger than ever is Sharepoint 2010, which many industries experts have shown a lot of love with. When working with Sharepoint 2007, I actually got amazed by its usability and how flexible and useful it could be in a business environment. The even more amazing part is, the bigger the business, the more useful Sharepoint could be to the business.
This post shows you how to retrieve a checkboxlist from a multi choice field as well as how to update the field using SPFieldMultiChoiceValue.
Aaron was creating a custom web service to be used by web parts in Sharepoint, but then there was a problem of a giant list of "undefined" values returning. Done a lot of research and later this brilliant post directed us to the right place.
I wanted to use Ajax control toolkit in Sharepoint, and had not had any luck until I spent the whole day debugging and getting it to work. I already had Ajax integrated in Sharepoint, so it should be fairly easy to just add in AjaxControlToolkit, but the problem is the latest version of it actually requires you to use ToolkitScriptManager instead of ScriptManager, otherwise your control will not work and you will see a Javascript error of "Please wait while scripts are loaded".
I had to create a task dynamically in C# and assign the task to a reviewer, which is a user account. However, there was this problem of the "Assigned to" field is only read only. To do that, just create an SPFieldUserValueCollection and assign it to task item.
I needed to get SPUser object from doing a lookup using CAML query, so that I could get the user information such as email address, etc. To do that, this is the code that I used:
I had the problem of not able to debug Sharepoint in Visual Studio 2008 awhile ago, and glad that Aaron shown me how to do it by doing some tricks. What happened was the PDB file might not have been deployed to the assembly GAC.
Today I was testing the loading time of my site, which I sometimes find it slow to access especially the first time loading. I knew there are a lot of images to be loaded especially those in portfolio sections but I also found that the biggest loading item seems to be ScriptResource.axd from Ajax. It was 330kb!
Yesterday I spent the whole day finding on the Internet about how to restore the list form web part of my edit form as I accidentally deleted it and could never get it back from the Closed web parts, nor could I get it back by resetting the file to site definition in Sharepoint Designer.
Lookup field is a field which links a child class to a parent class, it is an association kind, which allows a list item to reference another item from another list. However, reading and writing to a lookup field is different from a normal field. We need to use the class SPFieldLookupValue to archieve this.
Creating Update Panel in code behind dynamically can be a bit tricky, comparing to doing it at the front end. Here's a quick view of the code we write to do this.
I have been using StatCounter, as my website tracking statistic provider for many many years, even after Google Analytic came out. I liked Google Analytics but there is just one thing that Google can't provide that StatCounter does and that is the most useful piece of information I get from the stat.
I was trying to create a web part with WSPBuilder installed on Visual Studio 2008, but had the problem of rendering a user control. Then I came across this blog post, which explains the steps in wrapping usercontrol with WSPBuilder solution. What's even greater is we can setup a structure which seperates the application presentation layer with the WSP project.
One of the thing I hate most about Sharepoint is its naming. It does not tell the administrator what name it's actually storing a column field of, and this could always lead to errors.
Recently I had the chance to customise the advanced search box of Sharepoint server portal, with own fields/ properties and defined a seperate scope for it. It was not hard, but needs some research and practical experiments.
Recently, I had the chance to play around with ajaxifying Sharepoint server. As you would have probably known, Ajax is a great feature in .NET 3.5 but MOSS 2007 was shipped before Ajax was out. So, to use it, we just need some configurations done.
SharePoint list has permission down to the list level, but what if we need to control view, edit and display for each column? I have been researching on a lot of add-ons around the Internet and luckily found one that works just brilliantly. There's this add-on called SPListDisplaySetting, hosted on CodePlex, which allows you to do that. Strange thing is the first time I installed it, it didn't work as it cooked up my list to not showing the action toolbar and i had to re-install WSS to get it back in shape.
Sharepoint comes with a great GUI tool that allows administrator to create and manage data structure, that means we could create our own columns and set up the associations, etc. However, the default field types out from the box are limited. The great news is we could create our own field types with own business logic. I just tried to create a custom field type called "Phone Number", which is a standard text field but with Javascript validator that validates the input string to be a valid phone number.
I have been digging into SharePoint for awhile now and it seems to be more and more interesting and challenging, considering I already have experiences with so many different Content Management Systems. Suprisingly, SharePoint seems to work very similar to Helium, so that eased my process of going in and out of Sharepoint.
Online lending websites have grown big and popular these days, it's easy to find hundreds of websites created for people seeking finance to submit application online and get pre-approval, etc. However, not many of these websites have been done professionally or having a wow design. I had the chance to look through a lot of these websites and filtered out a list of the very good ones out there.
One of the best things of using LINQ is how easy we could sort or filter objects with a line of code. Consider we have a generic list of object of Employees and we want to filter them with their age. Using LINQ, we don't have to connect to the data source and get the SQL to do the where query. We can just do something like this...
I recently updated the homepage portfolio section with an Ajax filtering dropdown, allowing readers to filter my portfolio with different technologies and themes. However, that caused my old lightbox effect to lose ground somehow. After days of debugging, I found a way to deal with it, that is...
This has to be pretty simple, but I never actually realised it. That is, when we have a textbox, and a button aside, and we want to enter text into the textbox and do a postback by hitting enter on our keyboard instead of hitting the button aside. This can easily be done by wrapping the controls inside a panel, and then set the defaultButton property to the button's id. Gee, I never knew that...
I recently needed to show a datetime as amount of time left or past. This can be done by using TimeSpan, which you can get by subtracting one DateTime from another...
Jorge pointed out the other day that when we do a lot of string concatenation, it is better to use StringBuilder instead of the String class (e.g. str += "something more"; ). This is because StringBuilder gives a better performance when in memory than the standard String class, which requires garbage collection to remove.
I still remember the first time I started using Wordpress, that was not so long ago when the word 'blogging' started to appear on every media. Blogs have grown dramatically popular. Some blog for making pennies out of it, some blog for fun and variety reasons. Back in that time, there weren't many blogging platforms available, apart from those written as open source, such as Wordpress. It quickly became a hit year after year partly because of its simplicity of usage and free of charge.
A very easy way to connect ASP.NET application to use MySQL database is to use the MySQL Net Connector. With just the following lines of code, you can easily hookup your ASP.NET application to any MySQL db.
When using radio button in a repeater item template, there's a problem of grouping them to a unique name. Solution can be found:
http://www.developer.com/net/asp/article.php/3623096
Ever wanted to create a gradient image dynamically? This can easily be done using C# with the following snipplet of code. We can also specify the width, height, gradient direction (horizontal or vertical), and the two colors. By using LinearGradientMode class, a beautiful gradient image can be drawn in a sec.
Having a working sitemap in an ASP.NET application can't be anymore important. You can use it for navigations, breadcrumbs, etc. The default web.sitemap file is an XML file which provides the root node of the site, the SiteMapProvider used, and tracks the provider objects. System.Web.SiteMap inherits from System.Object. The default provider XMLSiteMapProvider works through the Web.sitemap. Besides being useful for site navigation, the sitemap also provides a easy way for search engines to look for pages on the site.
Doroton, a leading adelaide based food manufacturer specialising in wholeselling french tarts & patisserie has contracted Xplore to power their website. The website will showcase their wide range of popular products for leads and enquiries.
UserControls are great, particularly in making the code more eye friendly, seperating big bunch of codes into different parts and be able to re-use them throughout the application. However, there are times when we need to reference something in the parent page or control from the usercontrol level. That's when I had an issue today, and finally solved it using the brilliant delegate.
A very useful regular expression for validation Australian wide phone number, including mobile phones. This would accepts all forms of Australian phone numbers in different formats (area code in brackets, no area code, spaces between 2-3 and 6-7th digits, +61 international dialing code).
Friday, 01 May 2009 |
Filed in:
Tools
Have been playing a lot with a number of WYSIWYG text editors, such as RadEditor and many other free ones, but the one that I liked the most would be FCKEditor, which is open source editor, written in Javascripts and support a wide number of languages like PHP, ASP, JAVA, .NET, CFM, etc. It's extremely easy to integrate, especially in .NET
A very handy function to grab any query string using Javascript:
A very handy tool to compress the annoying webresources.axd script.
http://madskristensen.net/post/Compress-WebResourceaxd-in-ASPNET.aspx
Enterprise Library is a very useful component developed by Microsoft to help developers solving many common tasks. One that I use a lot is the data access block, which allows you to run data access query in just one line of code! (Saves all the work in writing a command and pass to a reader, etc).
When using ORM, should always keep in mind that only one object scope is used. The example came with the package doesn't really explain this well. Should always declare a page_init call which declares the object scope and store it in session and try to keep using it for any business operations:
How to convert data to xml file? Here is a very useful command to convert dataset or datatable to an XML Document:
For a method or properties to be overridable, it must has a virtual property in its base class set as true as well, is final must be set as true. To determine whether a method is overridable, it is not sufficient to check that IsVirtual is true.
I stumbled upon an error when deploying a web application onto IIS7 running on Vista. After days of trying to solve, it's actually due to the fact that the application is set to medium trust but it actually needs Full Trust due to using Reflection in the code.
Telerik's RadUpload control doesn't come with many documentation. The default comes with multiple file slots, with add and delete button but sometimes we might only need just one uploader.
Somehow Javascript complaint about Unterminated string constant when I tried to add a line break (\n) into a string variable. If viewed in source, it looks alright. After all, do something like that fix that problem:
When using ORM, after we have setup the business objects, it's useful if we create some generic methods which can be used in many places.
Sometimes, somehow Telerik controls might suddenly not appear in Visual Studio's toolbox. A quick solution would be mouse hover to toolbox, add a new tab, and then choose items. Then point to the Telerik bin file (Telerik.Web.UI) and that should populate all controls into the toolbox.
Telerik ORM (Open Access Mapping) has been a very useful tool, for mapping database structures into object oriented classes, so called Persistent Classes. This saves a lot of efforts in writing up these classes manually. What's more we could add on to it is to use generic methods on standard adding and deleting transaction.
Applying security for a web application is a very common task. There are always parts on a web site that requires private only access for members. Recently, I tried to use the form authentication method provided by .NET and found it quite simple to use, though I have always done it with sessions. The