moving columns in an autogenerated gridview

moving columns in an autogenerated gridview

am 04.04.2008 16:31:36 von JJ297

How do I move the select button to the last column in a gridview. I
read to use the Gridview1_PreRender control and do this but I can't
get it to work:

Protected Sub GridView1_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles GridView1.PreRender


datacontrolfield temp = gridview1.Columns[0]
If (temp Is CommandField) Then
GridView1.Columns.RemoveAt(0)
GridView1.Columns.Insert(2, temp)
End If
End Sub

Here's my gridview:

PageSize="100" DataKeyNames="TitleID"
BorderColor="#CFB37D" BorderStyle="Solid" Font-Bold="False"
Font-Names="Times New Roman"
ForeColor="Red" HorizontalAlign="Center" AllowPaging="True">









Any suggestions?