Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Gridview Checkbox Alignment Problem

Reply
Thread Tools

Gridview Checkbox Alignment Problem

 
 
JonBosker
Guest
Posts: n/a
 
      01-24-2007
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_SelectedIndexCha nged"
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 [Table]" DeleteCommand="DELETE
FROM [Table] WHERE SOmeId=@original_SomeId"
OnDeleted="SqlDataSource1_Deleted"></asp:SqlDataSource>

 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-24-2007
Check AlternatingRowStyle.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


"JonBosker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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_SelectedIndexCha nged"
> 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 [Table]" DeleteCommand="DELETE
> FROM [Table] WHERE SOmeId=@original_SomeId"
> OnDeleted="SqlDataSource1_Deleted"></asp:SqlDataSource>
>



 
Reply With Quote
 
 
 
 
JonBosker
Guest
Posts: n/a
 
      02-01-2007
On Jan 24, 6:31 pm, "Eliyahu Goldin"
<(E-Mail Removed)> wrote:
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
css radio button/checkbox alignment Prince HTML 1 02-22-2008 02:25 AM
Checkbox Text Alignment =?Utf-8?B?QmFobWFu?= ASP .Net 3 02-09-2006 10:00 PM
Text on Checkbox below the checkbox tshad ASP .Net 0 04-14-2005 11:26 PM
Checkbox text alignment tshad ASP .Net 0 03-07-2005 10:25 PM
checkbox, why alignment slightly offset foldface@yahoo.co.uk ASP .Net 0 04-15-2004 10:09 AM



Advertisments