ASP.NET Grid View

In this article, I’ll talk about and will give you reference links of simple ASP.NET grid view requirements which we are facing in day to day coding life :)

How to put radio button into ASP.NET Grid View:

http://techahead.wordpress.com/2008/04/01/aspnet-using-radio-button-inside-grid-view/


How to pass value from child window to parent window using JavaScript:


http://www.plus2net.com/javascript_tutorial/window-child3.php


How to pass data of child page grid view to parent window:


http://www.codeproject.com/KB/webforms/DataGrid_Row__Value.aspx


How to click button event on entering values into textbox and pressing enter key:


http://forums.asp.net/t/1361883.aspx


How to get readonly values from asp.net textbox to server side:


http://forums.asp.net/t/1460570.aspx


http://geekswithblogs.net/ranganh/archive/2007/05/10/112390.aspx

Object reference not set to an instance of an object. The Solution installation failed

I was getting error “Object reference not set to an instance of an object. The Solution installation failed” while adding and deploying my solution package from STSADM command, I have looked into my event log and SharePoint log to find out the exact error, I have found out that it’s related to Admin Content SQL database.  The current user who is executing the STSADM command must have full control access to this content database.

Then I run my solution package with service account and it ran well without any problem, here we can also add current user into content database and will give full control rights to current user to executing solution package.

Good Luck!

How to Integrate AJAX into SharePoint Site


AJAX toolkit
provides whole set of controls which we can use into SharePoint, one day I thought to use AJAX Tab control, after playing with control, I realized that apart from installing AJAX toolkit into server, I need to perform set of instructions or steps to make control working into SharePoint site.

We need to make changes into web.config file for respective web application, below are some of good links which give us information about what are the sections we need to add/edit into web.config file.

Reference Links:

http://mctalex.blogspot.com/2009/06/integrating-ajax-control-toolkit-into.html

http://www.devexpert.net/blog/pt/blog/Embedding-Ajax-Control-ToolKit-into-Shar.aspx

Here is one Codeplex tool which add all web.config entries for AJAX into SharePoint site ->

http://spajaxenabler.codeplex.com/

Take the advantage of AJAX controls!!

How to assign lookup values into List definition – schema.xml file

I had requirements in which I wanted to deploy my custom lists from one server to another server, I had generated my schema and forms files using solution generator tool, now when I open one of my generated schema file in which I have lookup columns linked to another custom list, I have observed that solution generator tool commented custom lookup columns, I mean it didn’t figured out which custom list to attached for lookup columns.

There are many ways to achieve these challenges, one way would be if we know GUID of custom list which we are going to look up on then we can write same GUID into list definition schema file, but in my case all custom list was deployed at same time, so I don’t know what’s GUID of lookup list.

Another solution I found was, we can write feature event receiver on custom list, so when feature install/deploy custom list at same time we can take lookup column list name and assign into lookup columns into list definition file.

But at the last I have found simplest solution to assign lookup values into list definition, there is property called “LIST” into fields columns for schema.xml file, so in same list definition file, we can write List=”Name of List” for lookup columns, so it will attached lookup list name for columns.

I hope that above information makes some sense to reader, but if it’s too confusing then please let me know about your challenges we can work out :)

Enjoy!

Error: Invalid data has been used to update the list item. The field you are trying to update may be read only.

I was getting error “Invalid data has been used to update the list item. The field you are trying to update may be read only” when I tried to update list items with incorrect value into People and group field, I was taking value from SharePoint People picker web control and update same values into SharePoint List columns.

Actually we need to pass and assigned value into specific format to people and group data type, below link describes very good and precise information on how to get values from SharePoint people picker control and update into list columns having people data type.

http://dishashah.wordpress.com/2009/06/18/how-to-display-users-to-sharepoint-peoplepicker-and-to-get-data-from-sharepoint-peoplepicker/

Enjoy!!

Access is denied. (Exception from HRESULT: 0×80070005 (E_ACCESSDENIED))

I have written web service program to fetch all list names from web application, in that case I was getting access denied error while retrieving Title of SPWEB object.

Error:

at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex) at ‘SPWEB.Title‘ threw an exception of type ‘System.UnauthorizedAccessException’

I have found that my current user don’t have access rights to access some of the sites, after giving required access rights my web service program gave me correct output without any errors.

:)

Difference between Microsoft Virtual PC and Virtual Server

One day one of my friend asked me which tool are you using for SharePoint development, Is It Virtual PC or Virtual Server?

I told him, hmmm, till now I am using Microsoft Virtual PC 2007 but I thought that let me find out what is difference between Microsoft Virtual PC and Virtual Server, after doing some research I have found out that basically Virtual PC is designed for desktop PC in which Windows XP operating systems running and Virtual Server designed for server PC in which Windows Server 2003/2007 or any server operating systems running.

Another main difference I have found was, in Virtual PC we can’t connect or access one Virtual PC to another PC, but if we have Virtual Server setup into our LAN then we can connect and access all Virtual Servers.

Extensions for Virtual PC files:

Virtual machine configuration files are .VMC files,
Virtual hard disk files are .VHD files
Virtual PC saved state files are .VSV files


Reference Links:

http://blogs.technet.com/megand/pages/271852.aspx : Brief and very good difference between Virtual PC and Virtual Server

http://blogs.technet.com/keithcombs/archive/2007/06/27/vmrcplus-goes-public-download-now.aspx : Download link for VMRPlus client (VMRPlus for running virtual server)

How to open InfoPath form library into new browser window

I have found many alternatives to open InfoPath form into new window, one of them would be to take InfoPath form link URL and put same URL into summary link web part or page viewer web part.

Reference Link:

http://www.infopathdev.com/forums/p/10464/37554.aspx

Error while updating SharePoint list, “The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again”

This error “The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again” is very common for beginners SharePoint developer, who start developing and digging into SharePoint object model, it’s coming while updating SharePoint list, the cause of error is due to security rights, if we make web.AllowUnsafeUpdates = true and then update the SharePoint list then we won’t get above error.

Sample Code:

Web.AllowUnsafeUpdates = true;
item["Title"]=”Sample”;
item.Update();

Happy Coding !!

Error while updating list items “Cannot complete this action. Please try again.”

I was getting error while updating list items; after looking into each code line by line, I have found that error comes due to incorrect syntax near CAML query, I feel that SharePoint didn’t give us good user friendly error message to debug into our code. After making correction, my code work well.

Enjoy!!