Gridview Checkbox Alignment Problem

J

JonBosker

I am having a strange problem - my GridView is displaying bits (from
SQL Server) as checkboxes (which is fine) but it shows each alternating
one centrally aligned.

Heading1 Heading2
Text [X] Checkbox
Text2 [X] Checkbox
Text3 [X] Checkbox
Text4 [X] Checkbox

My GridView is very generic and I use it to show data from any table.

I think it is controlled by CSS but which item / setting? Can anyone
help??

Here is my gridview defintion (I set the Select and Delete command at
runtime):

<asp:GridView ID="GridView1" runat="server"
DataSourceID="SqlDataSource1" AllowPaging="True"
OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
CssClass="GridStyle"
AllowSorting="True" OnRowDeleting="GridView1_RowDeleting"
Width="100%">
<RowStyle CssClass="RowStyle" HorizontalAlign="Left" />
<AlternatingRowStyle CssClass="AlternatingRowStyle"
HorizontalAlign="Left" />
<PagerSettings FirstPageImageUrl="../systemimages/First.png"
FirstPageText="" LastPageImageUrl="~/systemimages/Last.png"
LastPageText="" Mode="NextPreviousFirstLast"
NextPageImageUrl="~/systemimages/Next.png"
NextPageText=""
PreviousPageImageUrl="../systemimages/Prev.png" PreviousPageText="" />
<PagerStyle CssClass="CommandRowStyle" />
</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM
" DeleteCommand="DELETE
FROM
WHERE SOmeId=@original_SomeId"
OnDeleted="SqlDataSource1_Deleted"></asp:SqlDataSource>
 
J

JonBosker

Check AlternatingRowStyle.
Turns out it was not AlternatingRowStyle but RowStyle instead - and
more specifically I had an input sub-type (is that the word?) as shown
below:
..RowStyle
{
color:Navy;
font-variant:normal;
text-align:left;
}

..RowStyle input
{
width:90%;
}

I think that because it is set to 90% the control (checkbox) tries to
fill 90% of the box but as it cannot stretch ends up putting it in the
middle! Pretty bizarre! Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top