Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CheckBox and Datagrid: Row Formatting

Status
Not open for further replies.

jkb17

Programmer
Nov 27, 2000
156
US
Hello,

I have a checkbox on a datagrid displaying a true\false value. Code is fine and I have no problem with that.

However, I had initially set the row height at 5px so that the rows are lean. They look nice this way and this is how I prefer them. Since I've added the checkbox to a newly added column the rows are "fatter."

I've tried playing with the padding from the edit item template area on each item, etc, etc.

Any recommendation or advice so that I can bring down the row height and the checkbox appears tighter within the row? I don't need that padding\spacing around it.

Thanks

Jim
 
Just tried this and it works, the check boxes are tiny.
Use a regular <input type=checkbox runat=server>.
Accessed in code behind as [HtmlControls.HtmlInputCheckBox]

The regular <asp:checkbox.../>
puts a span tag around it preventing you from setting the style or css attribute to the actual rendered check box.

Code:
<asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns=False>
			<ItemStyle Height=5px Font-Size=1 CssClass=cls></ItemStyle>
				<Columns>
						<asp:TemplateColumn >
						<ItemTemplate >
							<input type=checkbox Runat=server ID=chk style="width:5px;height:5px;margin:1px"/>
						</ItemTemplate>
					</asp:TemplateColumn>
				</Columns>
			</asp:DataGrid>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top