Search This Blog

Friday, December 23, 2005

Cider's intellesense

Merry Christmas!!!

It's christmas time and I thought of using this spare time to try out the new WPF designer in VS2005. Well immediately I encountered a small glitch.

Problem: Once you place a control on a Panel or a Grid, VS2005 doesn't update the intellesense. Then I thought it is because you do not give a name to the control in XAML. Even giving it a name didn't work.

Solution: Compile the code and then check it. Bingo!!! You can see the controls listed in the intellesense.

Once again have a merry Christmas!!!

Tuesday, December 20, 2005

ASP.NET templates

Most guys would have looked into themes in ASP.NET 2.0. Microsoft has released a set of templates for ASP.NET 2.0 for those who need to get a head around master pages and xhtml standards-compliant templates

I liked them because they are straight out of the box, and can use easily.

Play music with .NET this holiday season

Yes, Don Box shows how to play piano with .NET. Want to check it out, click here.

Enjoy the piano.

Friday, December 02, 2005

DataGrid Pagination in Webparts

Today I had an issue with a data grid on a web part not paginating. After a bit of merry-go-around the web I could figure out how to do it.

The following is the sequence of steps.

Step 1: Set up your CreateChildControls

protected override void CreateChildControls()
dGrid = new DataGrid();
// write code to set up the data grid
// with your columns etc.

dGrid .PageIndexChanged +=new DataGridPageChangedEventHandler(dGrid _PageIndexChanged);


Step 2: Create the PageIndexChanged Event handler
private void dGrid_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e )
dGrid .CurrentPageIndex = e.NewPageIndex;
dGrid.DataSource = dtSource;

Step 3: Render the DataGrid

protected override void RenderWebPart(HtmlTextWriter output)

You should be in business. Happy coding guys.

Thursday, October 13, 2005

VS 2005 Web project build

Did you guys ever get a check out error like this one.

You get this error if your code is under source control. VS2005 checks in all folders that are on the files system (with in the project) to source safe. Then it is Source safe that tags it read-only and needing to check out on the next build you do.

The work around is simple, all you need to do is hide the bin folder using Windows explorer. Next time you open the project in VS2005, you will not see the bin folder and VS2005 will not checkin that folder to source safe. Wait, that is not all, however, you will see the bin folder in the Solution Explorer on the next rebuild. Don't panic, VS2005 will not check in the files again. So enjoy web projects now. For more info on this refer to:

Wednesday, October 12, 2005


After blogging yesterday, I couldn't rest until
I found that Microsoft has provided a property
on the object data source to address this situation.

You need to set the DataObjectTypeName to call an Update
or Insert method that accepts an object parameter.

DataObjectTypeName="Author" SelectMethod="GetAuthor"
TypeName="Author" UpdateMethod="Save" 

Happy Coding Guys.

Tuesday, October 11, 2005


ObjectDataSource is a cool feature of ASP.NET 2.0. It allows the abstraction of of the data access tier in a multi-tier approach. Data-bound controls can connect to the objectdatasource just like any other datasource. As the object data source is meant to hide the data layer from the presentation tier, you will not find CommandType properties such as the DeleteCommandType or the SelectCommandType. This helps in true abstraction of the data layer from the presentation layer.

Having said all good about ObjectDataSource, it is time disclose a fact. The ObjectDataSource cannot use methods that accept an "Object" as a parameter to Update, Delete or Insert. See the picture below

In the picture, you can see that the Update method is configured to UpdatePerson(Person person). However the runtime will error out with the following message.

"ObjectDataSource 'PersonDataSource' could not find a non-generic method 'UpdatePerson' that has parameters: FirstName, LastName. "

The cheat to this is to write a wrapper method around the UpdatePerson to accept individual attributes and use it. See code snippet below.

Public void UpdatePerson(string FirstName,string LastName)
Person p = PersonDAL.GetByName("John");
p.FirstName = FirstName;
p.LastName = LastName;


Tuesday, August 09, 2005

Visual Studio AddIn error

Good on the Visual Studio IDE extensibility projects. However one will encounter the following error trying to compile a new Add In project.

Error 1 The best overloaded method match for 'EnvDTE80.Commands2.AddNamedCommand2(EnvDTE.AddIn, string, string, string, bool, object, ref System.Array, int, int, EnvDTE80.vsCommandControlType)' has some invalid arguments c:\RND\MyAddin1\MyAddin1\Connect.cs 40 24 MyAddin1

Error 2 Argument '7': cannot convert from 'ref object[]' to 'ref System.Array' c:\RND\MyAddin1\MyAddin1\Connect.cs 40 140 MyAddin1

Microsft is aware and has two work arounds for this. I took the second one to make it easier and await a fix from Microsoft.

Happy coding guys.

Monday, July 11, 2005


It is nice to see how Indigo is coming out at the moment. Looks very promising. Hhhmm its time I need to get my hands on to Indigo.