Skip to main content


Showing posts from February, 2008

How to Move Rows in GridView Up and Down

I was developing a project in which I need shuffling of the rows inside gridview. I face alot of hurdles during this because none of the post I saw was providing the complete code for doing it. Therefore as I have finished this task I think that my post might help others who will try to do this.
In this post you will find two codes. First will be the source code and second is the vb code. Both are working in right way.

This Item Template is taking the value from the assigned Database:

<asp:TemplateField HeaderStyle-Font-Bold="true" HeaderText="Date"
asp:TextBox ID="cgrid_date" runat="server" EnableViewState="True" Text='<%#DataBinder.Eval(Container.DataItem,"date")%>'

This ItemTemplate is used for up button and in this I have also assigned Row Number as the value to CommandArgument.

ID="lblUp" runat="serveR" Font-Underline="true&quo…