Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello,

 

I am using a checkboxlist control. I am having trouble with arranging the

description of the checkboxes so that they line up left

centered and couple of spaces away from the checkboxes.

 

In the asp code, this is easy because the checkbox

and the description are on separate columns.

 

<td class="left">

<input name="task" type="checkbox" id="task">

</td>

<td class="left"> rsData("tasks")

</td>

 

So we get a checkbox and left centered description

that looks like this:

 

� Teach courses pertaining to the chemical and

physical properties and compositional changes of

substances.

 

( the above description is left aligned, but may not show like that on the forum,)

( "physical" and "substances" fall right under "Teach ")

 

In the .net code, the checkboxlist control is in one

column, hence both the checkbox and the description

show up in the same column.

 

<td>

<asp:checkboxlist id="Checkboxlist2"

DataValueField="company_name" TextAlign="right"

DataTextField="company_name"

DataTextFormatString="     {0}"

Runat="server"></asp:checkboxlist>

</td>

 

and we end up with

 

� Teach courses pertaining to the chemical and

physical properties and compositional changes of

substances.

 

which does not look good.

 

I suspect the solution might have something to do with

RenderBeginTag and RenderEndTag methods, but I am not

sure.

 

Do you know how I can create a custom checkboxlist control so that the text will appear

like the asp version?

 

Thank you,

 

Burak

  • *Experts*
Posted

One option might be this, to fake ASP.NET out and close the

table data tag yourself to keep the checkbox in its own column.

I'm not sure if or how well this will work, but try setting

DataTextFormatString to "</td><td>{0}".

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...