Thursday, October 29, 2009

Hardware virtualization check in WINDOWS – How to

Today at my work, I want to install VPC for Windows server 2008 64-bit. I don’t have any idea on how to install WS 2008 on VPC, because VPC by itself won’t support. It need Hyper-V installed on the server. So, googled and found some good free tools or utilities to check the hardware compatibility for the virtualization. Below are the tools used to find them out in simple way.

1. SecureAble: It is a simple tool which is really very light weight and shows us the system bit version, Hardware D.E.P support and hardware virtualization support. Download it here.

2. Cpu-z [CPUID]: which gives you complete hardware details. Download it here.

Check them to test your hardware.

I think, now you got to know how to check hardware compatibility for virtualization.

How to check what updates are installed on my machine?

This is a general question for administrators and windows users. We have two ways to test it. One is through GUI and another is through command prompt.

  • If your windows installed in full installation mode, then you can directly go to Start –> Windows Update –> View Update History. In that window you can check all the list of updates installed in your machine.
  • If your windows installed in core installation then open command prompt –> type the below command in it and hit enter.

wmic qfe list

Now, in the list it will shows all the list of updates installed in the server. Tested in Windows Vista and Windows Server 2008.

Is this post helpful to you?

Tuesday, October 27, 2009

How to drag and drop entities from server explorer to EDMX file Entity Framework?

I know for adding the tables/entities to the EDMX file from database, everyone should do this. You will open server explorer, connect to database, expand to tables and select tables you want to add and tried to drag and drop them to EDMX file. But you never succeeded… Am I right? So, Everyone thinks like this by default because we are well used the LINQ files these days. We have the drag and drop support in it. But in Entity framework we don’t have that option as far as I know. Then how to add new database objects to the edmx file? There are two ways one is manual and another is tool.

  • Manual: Open the edmx file in the xml editor to see the code and edit the changes as you needed. Which is complex and won’t yield good results.
  • Tool: We have an option from the diagram file edmx designer to update the model through designer. Which is very simple and we can add/remove objects as we need.

Note: For entity framework there is a special explorer in visual studio 2008 which helps us to see only entity framework related objects which is called "Model Browser". Which is really very simple to use and helps a lot if your DB is big.


How to add entities/database objects to EDMX file?

  • Open the EDMX file in design mode.
  • Right click on the designer surface. You have lot of options and among them choose the option "Update Model from Database.." as shown below.
  • image
  • Now, you will see the usual screen which has all the database objects in new window which you have seen while creating EDMX file.
  • image
  • That's it!!! This way you can add/remove/edit database objects in an EDMX file. Usually the drag and drop is the good user experience as it in is in Linq to SQL file. Hope Microsoft include this option in upcoming releases.

I think, you knew about how to add or update db objects in EDMX file now. Love to hear comments.

Unable to update the EntitySet Table because it has a DefiningQuery and no InsertFunction element exists in the ModificationFunctionMapping element to support the current operation

ASP.NET MVC is the technology released from Microsoft long time back. But I didn’t get time to dig into it and research on it. Now, I need to learn it as my next project is in ASP.NET MVC. So, I thought to give a try and want to show all records in a table and insert a new record in a table. On the way, The above is the exception which blocked me to go proceed. I didn’t do any mistake and always the above exception come into picture when I try to create a new record in table.

So, frustrated and started research on the error and debugging. After a long research found the issue in the Entity framework. The whole thing is only because I forgot to add primary key to the table in the database. Once I added the primary key and reconstructed the edmx file with new changes, All works fine and record added to table in database. So, what is happening inside is, entity framework is looking for a key in each and every table [Primary key]. So, don’t forget to add a primary key to each and every table which you want to use in entity framework file [.edmx]. Otherwise you always see this exception when you try to insert or update a record.

"Unable to update the EntitySet 'Table' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation."

Is this helpful? Follow me if you want to learn ASP.NET MVC framework. I started learning and will place all my experiences and problems I face in my blog. So, keep an eye on my blog for more updates.

Wednesday, October 21, 2009

Visual Studio 2010 BETA 2, Download now

Visual Studio 2010 BETA 2 is released. Get it and start researching on new things added in this version. We know it has more features and explorers in it and lot of options to simplify and faster development and .NET 4.0. So, why to wait. Get some time and download it now.

Monday, October 12, 2009

Install the latest Messenger security update!

"Microsoft has just released a new version of Messenger which includes important security updates to help keep you and your friends safe while you chat online. All Messenger users will be required to have the latest version to continue using the service."

Get it from here.

Thursday, October 8, 2009

Set Focus to ASP.NET control

This is the question I received from developers on how to set the focus to an ASP.NET control from server side. Because once page is posted back to server or when request sent to server, from the response we need to set the focus to some x control on the page from server side.

There are requirements like this. For example, we have multiple panels on the page and when you saved the data successfully of a panel then you need to show the user the panel they submitted with some successful message instead of showing them the top section of  page always. :) Otherwise, user always needs to scroll down to the panel where he edited the changes and see whether the data saved successfully or not. An user experience problem.

Usually, the way the developers will do is, catch the control in client side either using javascript or jquery, then they will write logic to set the focus to it. But it's not needed. We can simply use the existing functions available in ASP.Net and C# and implement the behavior without any pain. See below example on how to do that.

C# language by default providing some options to set the focus to an ASP.NET control on the page. There are two ways to do that.

  • You can directly use Focus() method to set focus to a control. 
  • You can use the Page object function named "SetFocus" to set the focus to a control as shown below. 
Note: Assuming "tbName" is the textbox control id on the page.

So, by using any of the above ways we can set the focus to a control from server side code itself. I hope this will help you. Please provide your comments on it.

NOTE: Don't try to set the focus to the control when it is in disable mode or invisible. This will give some problems in the client side.

Wednesday, October 7, 2009

Ajax and JQuery libraries with Microsoft CDN

This is the wonderful announcement from Microsoft that they have placed the Ajax and JQuery libraries with Microsoft CDN[Content Delivery Network]. This will surely save huge amount of bandwidth all over the net as ajax and jquery is using by most of the people on the net. Now, it will download faster as it is coming from the cache. They have placed these libraries on the domain So, if your site is on the net then use the urls from CDN and use them. Your browser downloads these files real quick than ever.

Example script for downloading jquery minified version:

<script src="" type="text/javascript"></script>

For more details:

Isn't it nice? Don't you say wow after reading it? It really saves so much of bandwidth. Please provide your comments on this announcement.

Import excel data to SharePoint list

This is one of the nice and best SharePoint feature that we have implemented. By default SharePoint will provide us an option to edit in spreadsheet or download list items in spread sheet. But, it doesn't have the option to import the excel data to SharePoint list. When we have data in excel format and want to import that data to a sharepoint list, then how to do. That is why we took it as a challenge and implemented this.

And second reason is, this feature has a nice and wonderful feature of column mapping. You can manually choose column to column mapping, so that the column names not needed to be exactly same. This is one of the best option in this feature.

This feature works for both SharePoint and WSS.

The installation is simple and it is using the codeplex sharepoint installer package to install the feature. As it is developed as a SharePoint feature, you can get this feature associated with each list under the actions tab once you activated it. You can call this feature by going to specific list, under actions menu item just click on the feature name. Then it will take to a page which has a nice user interface to upload an excel, then choose specific sheet and then map the fields as you want.

You can take a look at it here on CodePlex.

I think, this will help you out to import data from excel to SharePoint list problem. Isn’t it?

Tuesday, October 6, 2009

SharePoint list view web part wildcard search

I know, most of the SharePoint developers are looking for this. As everyone knows we can do partial search on data view web part by passing a parameter to it and by using the expression "contains" we can implement partial search on a field or column. But, when you come to list view web part you can't pass the parameters [There is no support for list view web part like web part parameters] and no way we can implement the partial keyword search. Today I have spent time on it to solve this problem with the help of my colleague Durga and found a wonderful way. This is giving really wonderful result and doing wild card search even on very big document libraries fast. Below are the steps I followed to solve this. [I will post detailed post on it with screen shots and nice explanation soon in this blog.]

  • Created an ASPX web part page in a SharePoint site.
  • Added two web parts to the page. One is for content editor web part and another is for list view web part of a SharePoint library or list.
  • Now, open the page in IE browser and add a text box, button to the content query web part.
  • Written simple logic to button click event of the button and reload the page with the below formatted url. The url should be of the format

"you aspx page url?FilterName=FieldName&FilterMultiValue=*valuefromtextbox*".

  • In above url, we are using two key value pairs to solve our problem.
  • First one is FilterName: which is for in which field of the list view we need to search the value. For example the value may be Title, ID etc…
  • Second one is the FilterMultiValue: Which is for what is the value we need to search. i.e. keyword. So, here you can pass multiple values too separated by semi-colon ';'.
  • So, example url should like this
  • http://mosssite/pages/listviewcustomwildcardsearch.aspx?FilterName=Title&FilterMultiValue=*prav
  • Now the above url will search all the records in the given list view for the keyword "prav". So, wherever it exists in the given field name it will return all records.

Then how it is working?
Generally, If you research on query strings for a list view web part, it expects some query strings to filter and sort. I am SharePoint developer and got to know the two query strings which SharePoint list view web part uses for filtering. FilterName and FilterMultiValue. So, with that my research continued and tried long time with so many operators like %, single quotes, double quotes etc… in the value of the FilterMultiValue. Finally, I tried with * character before and end of the keyword, there I succeeded. Example: *prav* to FilterMultiValue.

  • That’s it…. Working simply great.
  • With that, You are done implementing the wild card search in a column in list view web part.

Happy by doing SharePoint customization. I know, this will solve so many problems to SharePoint dev’s.  Isn’t it? Please let me know if you have any questions, issues and write your valuable feedback and comments.

Will post more descriptive explanation of this post with screenshots soon in this blog. Follow me!!!

Monday, October 5, 2009

SharePoint, WSS feature for DocuSign signature for free

This is one of the great feature that we have developed in SharePoint for document signature. Which is compatible with WSS too.

Signup at DocuSign website for a free account and use this SharePoint feature available at CodePlex to sign documents without any cost.
This is a simple/basic Version 1.0 of the tool that lets you sign or send requests for signature from a SharePoint library.
Lot more can be done. Please try this feature and provided your feedback and suggestions in Codeplex. 

Sunday, October 4, 2009

Client side validation of ASPX validation controls

This is the nice post under validating the ASPX validations in client side like java script. The concept behind is,

  • Some times we need to validate the .NET controls in client side whether they have correct values or not. We can do them in client side logic by using some existing functions available in javascript which are handled by ASP.NET framework.
  • And another requirement is on the page some controls are .NET controls and some are HTML controls. And all .NET controls are using the server side validation controls and html controls are using client side validation. So, when click on submit button, you need to detect whether form is valid or not on client side. So, you need to write some custom logic to detect all HTML controls are valid or not and then you need to detect all ASP.NET controls are having valid values or not. How will you detect that? You should validate both of them in javascript. So, this logic will help you to find the form is valid or not. 
function Page_ClientValidate(validationGroup) {
   Page_InvalidControlToBeFocused = null;
   if (typeof(Page_Validators) == "undefined") {
      return true;
   var i;
   for (i = 0; i < Page_Validators.length; i++) {
      ValidatorValidate(Page_Validators[i], validationGroup, null);
   Page_BlockSubmit = !Page_IsValid;
   return Page_IsValid;

The above function is taking an argument named validationGroup. This is the validation group of the server side validation control. And the output or return value returning is the boolean value. If it is returning true then it passes the server side validation and false then it fails the server side validation. So, along with it's value you can write your own logic to validate the html controls and test whether form is valid or not.

Hope this helps and you can solve so many problems with this logic. Always welcome your valuable feedback and comments. Do you know any other ways to implement it?