Can you stop the text from showing for a checkbox?

I’m using the following ASP control to pass a value through
the TEXT field:

<asp:CheckBox id="CoursePassed"


  checked='<%# Bind("CoursePassed") %>'

  text='<%# Bind("psnEventId") %>'    




And reading it in the following code:

    Protected Sub CoursePassed_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)

        Dim psnEventId As Integer = sender.text.ToString

        Dim createdBy As String = getUserLoginName(Me.Page)


        'Update changes to cmdCoursePassed

        Dim dataTableAdapter As New CMDTableAdapters.sp_CMDUpdateCoursePassedTableAdapter

        Dim dataTable As New CMD.sp_CMDUpdateCoursePassedDataTable


            dataTable = dataTableAdapter.GetData(psnEventId, _


        Catch sqlErr As Data.SqlClient.SqlException

            handleSQLError(Me, sqlErr, "Error saving CoursePass state.")

        End Try

    End Sub

But this shows the ‘psnEventId’ text next to the checkbox.
Is there a way to not display the text?

Can this be done using the VALUE type of the CheckBoxList control?
I’ve tried this, but it says I can’t use BIND

Any help?

2/12/2008 4:58:06 PM 72751 articles. 3 followers. Follow

6 Replies

Similar Articles

[PageSpeed] 33

The way you're coding this, you don't need Bind. Use the value, and use Eval. Bind is for 2 way binding - that is, something automatically getting the value for updating/inserting. You are doing it in code.

Please Mark As Answer posts that helped you.

"If we learn from our mistakes, I should be brilliant by now."

2/12/2008 5:43:25 PM

Sorry, but I'm not sure what you mean here.

'Value' is not a valid property of the 'CheckBox' type.

 Changing 'bind' to 'eval' won't get rid of the text showing on the screen!?


Am i missing the pint here?

2/12/2008 6:03:23 PM

This is a bit of a 'fudge' but I have used the CssClass property to store the value for a Checkbox to get round this.


2/13/2008 12:36:18 AM

Well, the way I do it is as follows (I am creating the control via code, but you could just as easily ste the Text property to ""):

Dim ItemControl As New CheckBoxList Dim i As Integer
ItemControl.ID = strItem 'the ID to be used for the checkbox

'I have a comma separated string with different checkboxes
Dim aryItemText() As String = dropItem3.Split("~")

'Set a common ID for the group
ItemControl.ID = strItem

'Loop through my array of checkboxes
For i = 0 To aryItemText.Length - 1
  'Use ListItem to set Name-Value pair for checkbox in group
  Dim ddListItem = New ListItem
  ddListItem.Value = CStr(i + 1)  'value is incremental number
  'dropItem5 is a setting to say whether to show text against the checkbox or not
  If dropItem5 = "FALSE" Then ddListItem.Text = "" Else ddListItem.Text = aryItemText(i)
  'Add the ListItem to the checkbox group

'dropItem2 sets layout properties: the checkboxes can be arranged vertically (repeatColumns=) ,or horizontally (repeatColumns>1)
If dropItem2 = "" Or dropItem2 = "not set" Then ItemControl.RepeatColumns = 0 Else ItemControl.RepeatColumns = CInt(dropItem2)
ItemControl.RepeatDirection = RepeatDirection.Vertical
ItemControl.TextAlign = TextAlign.Right
'Add the checkbox (in this case, to a table cell)

This way, the code (or DB settings actually via the dropItems) can decide whether to show the Text or not against the checkbox control.


2/13/2008 10:18:19 AM

 Thanks, this works. I was looking at doing this using a hidden text box with a CheckBoxList object showing one option, but this is a much neater solution.

I wouldn't have though of that! 

2/13/2008 10:19:56 AM

Good stuff, glad it was useful!

2/13/2008 10:34:36 AM

Similar Artilces:

RFValidator: Text not showing up next to control, but ErrorMessage showing up in VSummary control
I've added an HTML table, TextBox, Button, and RequiredFieldValidator control to a form.  There is plenty of free space beside the TextBox control.I set the ControlToValidate property of the RFV control to the ID of the TextBox, the Display property to either Static or Dynamic, and the Text property to "*". I click the button, and nothing shows up next to the TextBox, but if add a ValidationSummary control and set the RFV's ErrorMessage property to "*", the value of the ErrorMessage property shows up in the ValidationSummary control.This occurs in 2.x...

How can I get the description text of a checkbox control??
Hi, How can I return the descriptive text of a check box control to a power script variable (from a datawindow)? Thanks in advance. string ls_1 ls_1 = dw.Describe( "colname.CheckBox.text" ) -- Paul Horan[TeamSybase] VCI Springfield, MA Join the PB9 Book mailing list! "RKS" <> wrote in message news:ezKxELtADHA.250@forums-1-dub... > Hi, > > How can I return the descriptive text of a check box control to a power > script variable (from a datawindow)? > > Th...

How Can Show Complete Text in DropDownList Control?
Hello I have Fixed the width of Drodown list control. becuase due to lengthy data input it is going to disturb page layout . But i also want to show the data to user. how can i carry out this taskRegards, Malik Asif Joyia. Hi, You can display larger content in tootip rather then option text keeping the fixed width dropdown. Review this thread Tooltip display for a dropdown Please note that this is DHTML "way" of displaying tooltip and not native feature of the control. Regards~ Firoz AnsariPune, Indiahttp://www.firozansari.comWhy product testing is important? ...

Templating Login and CreateUserWizard controls
So I finally resorted to templating both my login and createuserwizard contols to get the functionality I need. However, in both cases, I can't get the failure text to show.According to the msdn documentation, you need to include a literal with an ID of "FailureText" which I have done in both cases inside the template: <asp:Literal id="FailureText" runat="server" />And naturally it's not working. I have the DuplicateUserNameErrorMessage for the CreateUserWizard control defined and the FailureText for the Login control and neither will display upon registration or login failure. I shou...

Can you have checkbox controls inside a list box control?
I am creating a website which has a list box control.  I have to add all the member names in the list box control.  Then a user should have the flexibility to choose one or more members from the list box and add them so he can send an email to all those selected users. So I thought of having check boxes next to the user names.  But it looks like you cannot have check boxes inside a listbox control (I use VS2005). But today I saw this website and this is exactly I have to do.  How do they do it?  Please look at the Categories and Industries.

how can i show image on image control after uploading by fileupload control
hey , can any one tell me how can i show my image after selecting it in fileupload control . the best way is that i put a button on the page which click set the image url to the image control. but then i have to activate server side code. but i do not want that . is there any other way . plz help me What do you mean activate server side code? You can use an asp:image control and set the ImageUrl property to the location of the file you uploaded.Peter Kellner and blogging athttp://PeterKellner.netMVP, ASP.NET Some serverside code is going to have to take place beca...

Why TreeView show as text in the webpage, but it can show as a tree in the disign entironment
dear all:My entironment is windows2003 enterprise server +IIS6+IE6.03790+vsstudio2003i want to use iewebcontrols,and do anything as the readme.txt file told me.when i run the build.bat , i fould a worning about a pasttime error for this warning is the root reason for the treeview and any other three controls just show text at my webpage??is there any expert told me how to fixed this problem, i have spent two days about this problemthanks a lot!    your's chen -- from china Did you copy the HTC controls to root of the site. For example, the TreeView has a prop...

Can we show menu control differently on value change of another control ?
For some reason I need to show a different menu bar in my web:Menu A if textbox1 on a page is "1" and shows Menu B if textbox1 has value of "2". I cannot afford to create duplicating aspx just for 2 versions of menu. Actually Menu A and Menu B should be identicle except Menu B has one more item in the Menu control.How can I achieve this ? ThanksThanks in advance for the help. I will try to credit the ones who helped but most important is we really do sincerely thanks to all who have helped. To avoid having to create separate site ma...

.Net 2
Hi Friends, I want to show Different Tabs for different information on my web form ( .aspx page ). I could not found Tab Control with .net 2005. I know there is some but couldnt find it. Can you please tell me from where can I add Tab Control to my web form ? Thanks in advance, Nirav With some tedious settings of properties on the menu control, it will behave like a tab control.  Then you need to use a multiview control and fill it with views.  Then you need to wire up the menu to the multiview or something.  I tried this before and it works, but we wrote our own contro...

listbox and chekbox?? how can i show item of listbox with checkbox and how can i use it ?
hello friends item of listbox with chekbox? how can i show item of listbox with checkbox and how can i use it ? i know that there is checkboxlist but when i use 50 item for it, it seems so huge.. i want checkboxlist to seems small like listbox... and i shoul move on item with clicking mouse scrool bar (there is on right of listbox and it seems small when i use 50 item or more) cheersMark as me if my question or my answer can be helpful for you :) Hi oguzkaygun, Based on my understanding, you would like to display the check boxes as the list box presents the list item. Thoug...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

VB6 ActiveX controls done in VS.NET 03/05
Hi peeps. I used to develop ActiveX controls in VB6 and when I'd hit F5 the control would appear effortlessly in IE.  How can I do this in .Net? ....Let's say I have a simple UserControl in VB6 with 1 button on it.  The code behind the button_click event  is only "UserControl.BackColor = vbBlue", how do I reproduce this in .Net so that I can view it on the web?  Is it that ascx files have replaced this? Any help and ideas appreciated. Ray. Dublin, Ireland. ...

Text for checkboxes not showing.
I am using Web Matrix to create my ASP page. I have a checkbox that I want text to the left of it. Teh way the code is going to work is when you check the checkbox it will enable a dropdown box. Here's the code Web Matrix generated: <div class="filter_ckdd"> <asp:CheckBox id="ckOther" runat="server" AutoPostBack="True" CssClass="filter_ck" OnCheckedChanged="ckOther_CheckedChanged" Text="Other" TextAlign="Left"></asp:CheckBox> <asp:DropDownList id="ddOther"...

I put my login control in ascx file. how can i show login control in master page?
Hi, I put my login control in ascx file and I want it showed in the master page. And when a user click login button the master page isn't refreshed. How should I use updatepanel cotrol? Is it nessesary I add special  codes in web.config to use update panel control? Thanks in advance. Sepid   Yes , you need to configure your website to use ajax , see this link,Anas Ghanem.Note:Please Don't hesitate to click "Report Abuse" link if you noticed something wrong on the forums...

Web resources about - Can you stop the text from showing for a checkbox? -

Checkbox - Wikipedia, the free encyclopedia
In computing , a checkbox ( check box , tickbox , or tick box ) is a graphical user interface element ( widget ) that permits the user to make ...

XYplorer adds flat select tool, timestamping, sticky checkbox selection and improves portable device ...
... them a date previously copied to the clipboard. sc_* - *.doc matches both files beginning sc_ and those with a .doc extension. Sticky checkbox ...

Beware of checkbox marketing!
... able to sell the product at all and the company will go out of business. (sometimes in those exact words) These are the two edges of the checkbox ...

Disable Lion’s Resume Checkbox When Shutting Down [Video How-To]
One of the most annoying features in OS X Lion for me has been the little checkbox on the shutdown dialog box that states, "Reopen windows when ...

A Checkbox On Your Tax Return Helped Kill Public Campaign Funding
You already hate tax season, and as you move wearily through the cold calculations of the 1040 form, you come across a familiar checkbox. It’s ...

Google's Clever Plan to Replace CAPTCHA With a Checkbox
CAPTCHAs are an unfortunate side effect of the internet. They're those irritating collection of numbers and letters morphed into some Surrealist ...

Great news: New EEOC checkbox category emerges
"Bow-tie'n white boys"? Hey, I tried to anticipate the next expansion in ethnic categorization yesterday with my proposal for recognition of ...

Checkbox Syndrome: Why We Spend Money on Things We Don't Need
Ever been overwhelmed by the temptation to buy the latest shiny thing because it's got another checkbox in the features column? We call this ...

Magid: Google ditching CAPTCHA for 'I'm not a robot' checkbox
We need better security, but we need to find systems that are hard for bad guys to break but easy for good folks to use. Google is one of the ...

Resources last updated: 12/30/2015 9:01:16 AM