473,383 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Can't center a checbox in a datagrid column

I am trying to center a checkbox in a datagrid column but the checkbox
always displays to the right. Below is the rendered html. I also used a
css-class with the same text-align: center attribute. The checkbox is used
in a TemplateColumn. Any ideas?

Also since a datagrid is rendered as an html table, how do I put custom
attributes in the <TD> tags since these tags are not in my aspx page?

Thanks.

<td>
<span style="text-align: center;"><input
id="dgLists__ctl3_active" type="checkbox"
name="dgLists:_ctl3:active" checked="checked" /></span>

</td>

John Dalberg
Dec 27 '05 #1
1 1738
And setting ItemStyle-HorizontalAlign="Center" to the TemplateColumn doesn't
produce what you are looking for?

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"John Dalberg" <no****@nospam.sss> wrote in message
news:20*******************@newsreader.com...
I am trying to center a checkbox in a datagrid column but the checkbox
always displays to the right. Below is the rendered html. I also used a
css-class with the same text-align: center attribute. The checkbox is used
in a TemplateColumn. Any ideas?

Also since a datagrid is rendered as an html table, how do I put custom
attributes in the <TD> tags since these tags are not in my aspx page?

Thanks.

<td>
<span style="text-align: center;"><input
id="dgLists__ctl3_active" type="checkbox"
name="dgLists:_ctl3:active" checked="checked" /></span>

</td>

John Dalberg

Dec 27 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pietje de kort | last post by:
Hello, why is the System.Windows.Forms.DataGrid so un-customizable? I am trying to build a DataGrid that will resize it's last column when there is room left over (make it fill the total...
3
by: Brad | last post by:
I'm working with a DataGrid in C#, and the user needs to be able add and remove columns from the DataGrid on the fly, without opening and closing the form. The scenario is this. I have a setup...
3
by: PeterZ | last post by:
Hi, In a running C# app with a datagrid control I select all rows in the dataGrid using CTRL-A, I then paste into some other app like notepad or Word but the column headings get left off. Is...
6
by: Robert Schuldenfrei | last post by:
Dear NG, After being away from C# programming for a spell, I am trying my hand at what should be a simple task. I have been hitting my head against the wall this morning. I have a simple order...
1
by: bill yeager | last post by:
I did some more debugging and found the following: 1) I placed the following code in the button event just to see if I could cycle thru the datagrid control collection: <code> Dim strhello As...
12
by: Vincent Vinet | last post by:
I am trying to center a datagrid horizontally on a form, yet it stays aligned right... the horizontal align property seems to be useless, just as putting the grid inside a centered div or table...
1
by: Jose | last post by:
Please como center a datagrid header and the data justify to right? Thanks a lot
0
by: slemen | last post by:
Hi, I'm creating column templates dynamically at runtime. How do I center within the column 2 check boxes in each column header? The columns are created using the technique described in MSDN...
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.