Help with setting checkbox list's row's height

vcharles
vcharles used Ask the Experts™
on
Hi,

My row's height seem to depend on the number of rows, how do I fix the rows' height regardless of mamy records listed?

V.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Ramkisan JagtapLead Developer

Commented:
have you given fixed height to Checkbox list? If yes, remove the hight and give height to listitem.

Author

Commented:
What do you mean by give  height to listitem?
Ramkisan JagtapLead Developer

Commented:
Looking at your other question, You are trying to apply css to the checkboxlist items.
i.e. Setting height of the Rows, Applying alternate row colors, onMouseover event of the row. You need to create css for the row style and apply it to the each item of the check box list.
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Author

Commented:
How do I apply the css to each item of the check box list?
Lead Developer
Commented:
there are so many answers on this in link below:
http://forums.asp.net/t/1277679.aspx/1

One of them is:

<style type="text/css">
.optred{background-color:red;}
.optblue{background-color:blue;}
</style>

Protected Sub Page_PreRender(sender As Object, e As EventArgs)
	Dim flag As Boolean = False
	For Each li As ListItem In ListBox1.Items
		If flag Then
			li.Attributes.Add("class", "optred")
			flag = False
		Else
			li.Attributes.Add("class", "optblue")
			flag = True
		End If
	Next
End Sub

Open in new window

Author

Commented:
Hi,

Is there a way to apply this code to all the checkbox list controls on my form?

Thanks,

V.

Author

Commented:
Hi,

I am still having issues with the row's height, when I remove a value form the height property, the rows look ok (Not too far apart), but when I add multiple rows the control expands too far down, how do I fix this problem without setting he height of the control?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial