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 :)

Game Development: Text 101 - Text Based Game With Finite State Machine

This time, I've created a really simple text based game that allow the player to progress state to another state by choosing some option...