Thursday, November 29, 2012

ASP.NET Tips : How To Give Easy Row Number to DataGridView or DataGrid

I find It very annoying when adding row number to a query result, espesially when you're working with different RDMS like Oracle or SQL Server. They have their own syntax for row numbering. But when you use that in a GridView or DataGrid, it will be a piece of cake. You can try using this technique in just like example :


<Columns>
<asp:TemplateColumn HeaderText="No.">
    <ItemTemplate>
<asp:Label runat="server" ID="LabelNumber" 
Text="<%# Grid1.PageSize*Grid1.currentPageindex + Container.ItemIndex+1%>">
</asp:Label>
</ItemTemplate>     
</asp:TemplateColumn>
</Columns>

Add a new column for your Row number. And you will find Grid1 is the ID of your GridView or DataGrid.

Here's give it a try :)

Thursday, May 10, 2012

Bug Fixing & Troubleshooting : Retrieving the COM class factory for component with CLSID Error

Hi guys... It's been a really long time since my last post. Today I'll write my bug fixing and trouble shooting experience :  Retrieving the COM class factory for component with CLSID {2F422F62-D11B-11D0-8384-00A0C92018F4} failed due to the following error: 80040154.

This error usually occur when we develop in different type of CPU processor and OS. I've developed a web based application in windows server 2003 32-bit and then I moved them into a Windows server 2008 64-bit. And when I was running the application that execute a method from a 32-bit dll, it always shows that error message. After several hours working and searching in google, I found that there is special setting in IIS that allows application pool to execute 32-Bit applications.

So the solution steps are :

  1. Press ctrl + run. (to open Run)
  2. Type inetmgr then press enter ( to Open IIS)
  3. Expand the server name tree and you'll find Applications Pool.
  4. In the right side of the view, choose the application pool that your application using.
  5. And in the most right panel there is an Advanced Settings under the Edit Application Pool group.
  6. There'll appear an Advanced Settings dialog, and change the Enable 32-Bit Application value into True.

And It worked well for my problem... :)

and if you find my post is useful, please share a comment. :)

See you next time.

Finally, C# 9 record, the equivalent of Scala's case class

While C# is a wonderful programming language, there is something that I would like to see to make our life programmer easier. If you are fam...