Murray Brown
asked on
ASP.net GridView template check box and button fields on the right instead of the left
Hi
I am using the following GridView in my ASP.net web app. The check box and button field appears on the left of my data.
How do I get it to rather appear on the right? Thanks
I am using the following GridView in my ASP.net web app. The check box and button field appears on the left of my data.
How do I get it to rather appear on the right? Thanks
<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Width="100%">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkSelected" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Strongly Disagree" HeaderStyle-Font-Size ="Small"
ControlStyle-Font-Bold ="false" ControlStyle-Forecolor ="DarkRed"
ControlStyle-Font-Size ="Smaller">
<ItemTemplate>
<asp:Button ID="Button10" runat="server"
CommandName="MyButton5"
CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
Text="Strongly Disagree" />
</ItemTemplate>
<ControlStyle Font-Bold="False" Font-Size="Smaller" ForeColor="DarkRed" />
<HeaderStyle Font-Size="Small" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
ASKER
Hi. Where would I put that?
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkSelected" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
ASKER
I changed it to the following markup but still get what you see in the image below
<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" Width="100%">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkSelected" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Strongly Disagree" HeaderStyle-Font-Size ="Small"
ControlStyle-Font-Bold ="false" ControlStyle-Forecolor ="DarkRed"
ControlStyle-Font-Size ="Smaller">
<ItemTemplate>
<asp:Button ID="Button10" runat="server"
CommandName="MyButton5"
CommandArgument="<%# CType(Container,GridViewRow).RowIndex %>"
Text="Order" />
</ItemTemplate>
<ControlStyle Font-Bold="False" Font-Size="Smaller" ForeColor="DarkBlue" />
<HeaderStyle Font-Size="Small" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
ASKER
I think the alignment sends it to the right of the column. I need the check box to be on the right of the GridView itself
Are you using bound columns? are they auto generated?
ASKER
Yes I am using bound columns
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
Open in new window