i have a GridView control that is bound dynamically to an AccessDataSource.
the GridView control has the attribute 'AutoGenerateColumns' to be true.
when i add a 'delete field' to the grid control (by code or by the edit columns feature), it gets added in the beginning of each row. however, i want it to be at the end of each row .
how i can do it ?
thanks
![]() |
0 |
![]() |
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
</Columns>
</asp:GridView>
Girijesh
http://www.girijesh.in/
![]() |
0 |
![]() |
that still makes the delete/edit button appear in the left (in the beginning).
how to make it appear on the right (end of each row) .
please this is very important .
![]() |
0 |
![]() |
Click on the smart tag of the gridview( small arrow on the upper right corner) and select Edit Columns. In the dialog box and your re-arrange the columns from the Selected fields listbox.
Thanks
Mark post(s) as "Answer" that helped you
Electronic Screw
Website||Blog||Dub@i.net
![]() |
0 |
![]() |
Use Edit Columns option. It is used for arrange the fields and buttons.
![]() |
0 |
![]() |
thats okay when i bind the data using the wizard. my case is to bind the data dynamically. which means there is no columns before compilation. when i add the delete field using the smart tag it add it to the beginning of the row. i hope you get my point. thanks
![]() |
0 |
![]() |
Hi, dihmy:Girijesh has presented the answer to your problem.
But there is another point I want to stress that you should put the code
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
at the end of the column, like<
Columns>
<asp:HyperLinkField FooterText="Test" DataNavigateUrlFields="name" DataTextField="name" Target="_blank" HeaderText="Open Link" />
<asp:BoundField DataField="name" HeaderText="name" SortExpression="name" >
</asp:BoundField>
<asp:BoundField DataField="number" HeaderText="number" SortExpression="number" >
</asp:BoundField>
<asp:BoundField DataField="age" HeaderText="age" SortExpression="age" />
<asp:CheckBoxField DataField="isMarried" HeaderText="isMarried" SortExpression="isMarried" />
<asp:BoundField DataField="birthday" HeaderText="birthday" SortExpression="birthday" />
<asp:CommandField ShowEditButton="true" />
</Columns>It works well.
Sincerely,
Techie Zhang
Microsoft Online Community Support
![]() |
0 |
![]() |
dihmy:
the GridView control has the attribute 'AutoGenerateColumns' to be true.Techie Zhang - MSFT:
Hi, dihmy:Girijesh has presented the answer to your problem.
But there is another point I want to stress that you should put the code
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
at the end of the column, like<
Columns>
<asp:HyperLinkField FooterText="Test" DataNavigateUrlFields="name" DataTextField="name" Target="_blank" HeaderText="Open Link" />
<asp:BoundField DataField="name" HeaderText="name" SortExpression="name" >
</asp:BoundField>
<asp:BoundField DataField="number" HeaderText="number" SortExpression="number" >
</asp:BoundField>
<asp:BoundField DataField="age" HeaderText="age" SortExpression="age" />
<asp:CheckBoxField DataField="isMarried" HeaderText="isMarried" SortExpression="isMarried" />
<asp:BoundField DataField="birthday" HeaderText="birthday" SortExpression="birthday" />
<asp:CommandField ShowEditButton="true" />
</Columns>It works well.
-MSFT next to your name? Huh! When the "AutoGenerateColumns" is set to true, you dont find BoundFields. All you will see in the SelectedColumn list is the EditButton and it appears in the first column. The user needs to add the BoundFields explicitly and re-order them.
Thanks
Mark post(s) as "Answer" that helped you
Electronic Screw
Website||Blog||Dub@i.net
![]() |
0 |
![]() |