Monday, February 23, 2009

Error updating JScript IntelliSense: jquery-1.3-vsdoc.js: 'jQuery.support.htmlSerialize' is null or not an object @ 1416:4

Even after adding the IntelliSense file for JQuery, you might still get an error as below,

"Error updating JScript IntelliSense: jquery-1.3-vsdoc.js: 'jQuery.support.htmlSerialize' is null or not an object @ 1416:4"

Atleast in my case the reason was, i was using a JQuery-UI library and it was due to a conflict between the JQuery and JQuery-UI library. The first workaround i did was create an empty file for the Jquery-UI library with the extension -vsdoc.js or you can create your own intelliSense file.

Hope this helps.

"Error updating JScript IntelliSense: jquery.js: Object doesn't support this property or method" Intellisense error with JQuery and Visu

If you are using JQuery, you probably won't be getting any intellisense from Visual Studio 2008. But as part of ASP.NET MVC Microsoft started shipping JQuery. In order to make the Intellisense work follow the steps that i have tried,

1. Install the SP1 patch for your Visual Studio 2008. You can download the patch for free from here.

2. Download the install the patch that recognizes the -vsdoc.js intellisense files from here.

3. Download the vsdoc.js files from here and drop it along with your Jquery-x.x.js files.

4. To refresh the Intellisense from within our IDE you can use CTRL+SHIFT+J.

Hope this helps.

Thursday, February 12, 2009

ObjectDataSource - Selectcount method with custom parameters and custom paging.

On one of my project i was using ObjectDataSource with several parameters. I had a business logic layer with a method (For eg. GetProducts) which returns the actual recordset to be displayed also i had some logic to calculate the total records within the same method and i was populating a private member. I had a separate method to return the count from the private member and this method takes no parameter.


For e.g.

public class ProductLogic
{
  private int rowCount;
  public IList<Product>GetProducts(string filter, int maxRows, int startIndex)
  {
    ...
    ...
  rowCount = 'logic to populate the count
  }
  public int GetProductCount()
  {
    return rowCount;
  }
}


My ObjectDataSource declaration is...




<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"

SelectMethod="GetProducts"
TypeName="ProductLogic" SelectCountMethod="GetProductCount" EnablePaging="true"
OnSelecting="Obds_Selecting"
SortParameterName="sortExpression"
>


The problem i was facing was whenever objectdatasource makes a call to the "GetProductCount" method it was expecting me to pass all the parameters like "GetProducts". I did a Google Search but i couldn't find any information. So I did the following working around,

There is a ExecutingSelectCount property you can use to decide whether the ObjectDataSource is getting the list or the count. So using this property whenever it makes call to your count method just clear out your inputparameter collection and you should be good to go. So my CodeBehind looks like this...


protected void obds_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
  if (!e.ExecutingSelectCount)
  {
    e.InputParameters["filter"] = ....;
  }
  else
  {
    e.InputParameters.Clear();
  }
}

Let me know if you still have any issues i will try my best to answer it.