asp:checkbox LabelAttributes.Add

Hello,
I have a user control with an asp:checkbox next to a description of a workshop. i'm being asked to program the checkbox so that when a user checks the checkbox, the checkbox control returns the name of the checkbox (in a string format with other than  the name of the checkbox) and a string value (other than just "true" or "false" .  For example, if checkbox ID="chk_workshop_01", i'm trying to replace the name of this checkbox control to "Workshop One Date:" and if "chk_workshop_01.checked = true" Then replace the value "true" with a string like "April 23, 2010"

I'm trying to work with the  labelattributes like this:
chk_workshop_01.LabelAttributes.Add("April 23, 2010", "lblWorkshop_01") but I'm not having any success.  

All i need is a return from the form is a checkbox control with a string name and a value other than "true" or "false" instead of "true" or "false"

Any help with this is greatly appreciated.
Codeaddict7423Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Meir RivkinFull stack Software EngineerCommented:
>>the checkbox control returns the name of the checkbox
returns where?
can u post a screenshot of the user control?
0
LotokCommented:
I am not a 100% clear on what you are asking.
Would a label, where the text property changes when your textbox is checked sort you out?
0
Codeaddict7423Author Commented:
Lotok:
Thanks for the quick reply.  I am attempting a new way to tackle my earlier problem of having a checkbox in a user control displayed within a *.aspx page.  What I'm trying to do is the following:
A user fills out various textboxes with name, address, email, etc. and checks a checkbox to indicate the name and date of a conference to attend. This checkbox control now gets returned by email with the name of the checkbox (like "chk_workshop_01") and a "true" indicator if cheked or "false" indicator if not checked. What i want is to have this checkbox return by email with a name other than "chk_workshop_01" and an inidcator containing a string like "April 23, 2010" if checked and a blank if not checked. I was thinking that a checkbox property like "labelattributes "  might do the trick.

Please help.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

LotokCommented:
rather than returning checkbox.id in the email, you could just have something like below amoung the code generating the email. Just return the string in the email.

The other option is to create a custom attribute which attaches a label to the checkbox. If you dont like the code below I can see if I can mock something up like that or point you to a good tutorial (depends if time permits)
dim x as string = ""
if checkbox1.checked = true then 
x = "Chosen Conference: April 23, 2010 "
else
x = "Not Attending"
End If

Open in new window

0
Codeaddict7423Author Commented:
Lotok:
Thank you for the quick reply. unfotunately i don't have access to the code generating the email. is there any way you can  think of having this checkbox return something other than the checkbox name and "true"/"false"?  i have to  have something working to show today.
0
LotokCommented:
Checkboxes do have a text property which is usually used to show the end user what they are for.

for example you could change "Tick Here for Event"  to  "Chosen Conference: April 23, 2010 "

You cant change the variable name and the boolean value has to be a boolean so there is no point changing that. The .text option is your best bet.
chk_workshop_01.text = "Chosen Conference: April 23, 2010 "

Open in new window

0
LotokCommented:
Can you clarify for me, the email being generated by 3rd party code just provides the variable name? or is it the control ID? as well as the boolean value...  
Do you have even have access to other properties of the control?

If you were really struggling,  chk_workshop_01.ID = "Chosen Conference: April 23, 2010 " * might* work.
I am not sure if it will like havign the ID changed at runtime.
0
Codeaddict7423Author Commented:
Lotok:
Thank you. I tried your suggested text change and did display on the form but returned only the name of the control (chk_workshop_1) and a "true" next to the id.  I've been able to pass a value to a label and display that well. Is there any way to have a checkbox, when checked,  return somethign other than "true" or "false" or maybe return a blank?
0
LotokCommented:
No, the checkbox control returns a boolean.
What is returning the checkbox name? A 3rd party piece of code for which you dont have the source?

You can trying changing the ID at runtime, other than that, are you really stuck with a checkbox or can you change it to a DDL? a drop down list could have attending/not attening as the text shown on the page and then the date or blank as a value. It would seem to fit your needs better.
0
Codeaddict7423Author Commented:
Lotok:
Thanks for your help. i'm getting there... you mentioned ch anging the checkbox ID at  run time. Is there a way to replace a checkbox ID of something like "   <asp:CheckBox ID="Workshop_One_Date" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged"  Text="Chosen Conference: April 23, 2010 "    />
when Workshop_One_Date.checked replace Replace("_", " ")
VS indicates that "replace" is not a member of checkbox.  do you know a workaround?
0
Codeaddict7423Author Commented:
Lotok:

I came across this article and tought perhaps we could devise a solution to my checkbox issue.

http://forums.asp.net/p/1050481/3774639.aspx#3774639

It seems that checkbox controls are rendered at runtime surrounded by a <span> tag and that this tag also creates a label based on the UniqueID (checkbox id) of the control. I'm trying to find a way to access and change this <label>  </label> tag to add my own string instead of the checkboxID

thanks,


0
LotokCommented:
Try this
****MARKUP****

<asp:CheckBox ID="Workshop_One_Date" runat="server" AutoPostBack="true" Text="Chosen Conference: April 23, 2010" />

****CODE BEHIND****

Protected Sub Workshop_One_Date_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Workshop_One_Date.CheckedChanged
        If Workshop_One_Date.Checked = True Then
            Workshop_One_Date.ID = "chkWorkShopOneChecked"
        Else
            Workshop_One_Date.ID = "chkWorkShopOneNotChecked"
        End If
    End Sub

Open in new window

0
Codeaddict7423Author Commented:
Lotok:
thank you for your suggestion. I tried it several times however, the ID of the checkbox is the only item returned.  I have a solution for a dropdown box but i'm being asked to create a checkbox solution that identifies the checkbox (but  not with the checkbox ID) and its value (not "true" or "false" but with a date string).  I'm nearing the end of my time to have this. Can you think of any solution, even if it's to replace the "true" or "false" with a string?
Thanks,
0
LotokCommented:
You cant replace the true or false with a string, it's a boolean value.
Changing the ID like my previous example works. So they dont want to ID changed now?

If you dont have access to the email source, so you cant just insert a string or have the checkbox control a label.
They dont want to use the returned control ID as a method of returning the string
They dont want to change the control away from checkbox
They dont want to use the checkbox text property

It sounds like the only solution they want is to change the true or false value to a string which cannot be done. If they are willing to have something else done please clarify, but it seems like a no goer.
0
Codeaddict7423Author Commented:
Lotok:

thank you, having that response gives me a little cover when explaining progress...
I was thinking of a possible compromise. I was able to pass the value of a string to a label. that seems to work.

My question now is this:  is there a way to not display the "true" or "false" when the checkbox is checked.  I can handle the reply with a label.text="string" for true or false, but is there a way to hide the "true" / "false" reply?
0
LotokCommented:
The only way the true or false is showing is if the source of the page is set to display it.

Before you said you couldn't use a label, but now you have been allowed. From that I take it that you have access to the source but have limited permission to change it?

Can you post some of the source code? That way I can see where the checkbox details are being shown and advise you how to prevent it. It will somewhere be showing the result of checkbox.checked to display the true or false..

I will be able to see better if you can provide code.
0
Codeaddict7423Author Commented:
Lotok:
Below, please find my code:
---------
<%@ Control Language="VB" ClassName="RSVP_FEMAnopaychkbox" %>

<script runat="server">
 
    Protected Sub RSVPForm1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
       
        If (Not IsPostBack) Then
                 
            'Dim dd As ListBox
            'dd = RSVPForm1.FindControl("DateOfWorkshop")
           
            'Dim cb As CheckBox
            'Dim lblWorkshop_01 As New Label
            'Dim lbl_workhop_one As New Label
     
     
            ' Dim Date_of_First_Workshop As TextBox = CType(RSVPForm1.FindControl("Date_of_First_Workshop"), TextBox)
            Dim lblWorkshop_01 As Label = CType(RSVPForm1.FindControl("lblWorkshop_01"), Label)
     
            'Date_of_First_Workshop.Visible = "false"
            lblWorkshop_01.Visible = "false"
           
           
            'Dim Date_of_Second_Workshop As TextBox = CType(RSVPForm1.FindControl("Date_of_Second_Workshop"), TextBox)
           
            Dim lblWorkshop_02 As Label = CType(RSVPForm1.FindControl("lblWorkshop_02"), Label)
           
            'Date_of_Second_Workshop.Visible = "false"
            lblWorkshop_02.Visible = "false"
           
            Dim Workshop_One_Date As New CheckBox
            Workshop_One_Date.LabelAttributes.Add("Date of Workshop", "April 23, 2010")

           
            Dim Workshop_Two_Date As New CheckBox
            Workshop_Two_Date.LabelAttributes.Add("Date of Workshop", "May 11, 2010")
           
           
        End If
    End Sub

</script>




<script runat="server">
    Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
       
        Dim Workshop_One_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_One_Date"), CheckBox)
        ' Dim Date_of_First_Workshop As TextBox = CType(RSVPForm1.FindControl("Date_of_First_Workshop"), TextBox)
     
        Dim lblWorkshop_01 As Label = CType(RSVPForm1.FindControl("lblWorkshop_01"), Label)
        lblWorkshop_01.Visible = "false"
 
     
        'Dim strWorkshop_One_Date As String
        'strWorkshop_One_Date = Workshop_One_Date.ID()
       
        'Dim strDate_of_First_Workshop As String
        'strDate_of_First_Workshop = Workshop_One_Date.ID()
                 
        If Workshop_One_Date.Checked = True Then

            'Workshop_One_Date.LabelAttributes.Add("April 23, 2010", "Workshop One Date")
           
            'Workshop_One_Date.Checked.ToString()
           
            'Workshop_One_Date.InputAttributes.Add("April 23, 2010", "Workshop One Date")
           
            lblWorkshop_01.Visible = "true"
           
            'lblWorkshop_01.Text = "Date of Workshop: April 23, 2010" & Workshop_One_Date.Checked.ToString()
           
            lblWorkshop_01.Text = "Date of Workshop: April 23, 2010"
            Workshop_One_Date.ID = "Date of Workshop One: April 23, 2010"
            ' Workshop_One_Date.ID = "Date of Workshop One: April 23, 2010"
           
            'Date_of_First_Workshop.Text = "April 23, 2010"
            'Date_of_First_Workshop.Visible = "true"        
        Else
            Workshop_One_Date.Text = " "
            ' Date_of_First_Workshop.Text = ""
            lblWorkshop_01.Visible = "false"
         
        End If

    End Sub
</script>

<script runat="server">
 
    Protected Sub CheckBox2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
       
        Dim Workshop_Two_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_Two_Date"), CheckBox)
       
        Dim lblWorkshop_02 As Label = CType(RSVPForm1.FindControl("lblWorkshop_02"), Label)
   
        lblWorkshop_02.Visible = "false"
       
        If Workshop_Two_Date.Checked = True Then
           
            lblWorkshop_02.Visible = "true"
            'lblWorkshop_02.Text = "Date of Workshop: May 11, 2010" & Workshop_Two_Date.Checked.ToString()
       
            lblWorkshop_02.Text = "Date of Workshop: May 11, 2010"
           
           
            'Date_of_Second_Workshop.Text = "May 11, 2010"
            'Date_of_Second_Workshop.Visible = "true"
            lblWorkshop_02.Visible = "true"
        Else
            Workshop_Two_Date.Text = " "
            ' Date_of_Second_Workshop.Text = ""
            lblWorkshop_02.Visible = "false"
           
           
        End If
    End Sub
</script>


    <HGACServerControls:RSVPForm ID="RSVPForm1" runat="server" RSVPContactEmail="luis.hernandez@h-gac.com" OnLoad="RSVPForm1_Load" RSVPCode="FEMA Workshop Registration Form" Width="530px" RSVPAmount="25.00" RSVPFinancialCode="0000-000" RSVPExpireDate="05/31/2010"  >

<AdditionalFormControls>
       
       
        <p style="font-size: x-small; color: red; text-align: center"><br /><br />
    * denotes required fields.  <br /></p>
   
   
 <table width="620" cellpadding="0" cellspacing="0" style="border-color:blue" border="0">
     <tr>
  <td colspan="4" style="width:100%" valign="top" align="left"><strong><span

style="color:crimson">Contact Information</span></strong><br /></td>
  </tr>
  <tr>
  <td colspan="4" style="width:100%" valign="top" align="center">&nbsp;&nbsp; </td>
  </tr>

    <tr>
   <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label2"

runat="server" AssociatedControlID="tbFName" Text="First Name:"></asp:Label>&nbsp;&nbsp;</td>    
       <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox

ID="tbFName" runat="server" Width="190px"></asp:TextBox></span></td>
     <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span

style="color: red">*</span>&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator1"

runat="server" ControlToValidate="tbFName" Display="Dynamic" ErrorMessage="First Name is

required"    EnableClientScript="true" SetFocusOnError="true"></asp:RequiredFieldValidator>  

</td></tr>
     
     
      <tr>
   <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label1"

runat="server" AssociatedControlID="tbLName" Text="Last Name:"></asp:Label>&nbsp;&nbsp;</td>    
       <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox

ID="tbLName" runat="server" Width="190px"></asp:TextBox></span></td>
     <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span

style="color: red">*</span>&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator9"

runat="server" ControlToValidate="tbLName" Display="Dynamic" ErrorMessage="Last Name is

required"   EnableClientScript="true" SetFocusOnError="true"></asp:RequiredFieldValidator>  

</td></tr>
     
      <tr>
     <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label6"

runat="server" AssociatedControlID="tbTitle" Text="Title:"></asp:Label> &nbsp;</td>
     <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox

ID="tbTitle" runat="server" Width="190px"></asp:TextBox> </span> </td>
     <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%">&nbsp;     </td>
       </tr>
     <tr>
   <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label3"

runat="server" AssociatedControlID="tbOrganization"

Text="Organization:"></asp:Label>&nbsp;&nbsp;</td>
   <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox

ID="tbOrganization" runat="server" Width="190px"></asp:TextBox></span></td>
    <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span

style="color: red">*</span>&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator2"

runat="server" ControlToValidate="tbOrganization" ErrorMessage="Organization is required"

Display="Dynamic" EnableClientScript="true"

SetFocusOnError="true"></asp:RequiredFieldValidator></td></tr>
     <tr>
     <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label100"

runat="server" AssociatedControlID="tbAddres" Text="Address:"></asp:Label> &nbsp;</td>
     <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox

ID="tbAddres" runat="server" Width="190px"></asp:TextBox></span> </td>
     <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span

style="color: red">*</span>&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator5"

runat="server" ControlToValidate="tbAddres" ErrorMessage="Address is required" Display="Dynamic"

EnableClientScript="true" SetFocusOnError="true"></asp:RequiredFieldValidator></td>
       </tr>
  <tr>
     <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label8"

runat="server" AssociatedControlID="tbCity" Text="City:"></asp:Label> &nbsp;</td>
        <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox

ID="tbCity" runat="server" Width="190px"></asp:TextBox> </span> </td>
     <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span

style="color: red">*</span>&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator6"

runat="server" ControlToValidate="tbCity" Display="Dynamic" ErrorMessage="City is required"

EnableClientScript="true" SetFocusOnError="true"></asp:RequiredFieldValidator>    </td>
       </tr>
     
      <tr>
     <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label9"

runat="server" AssociatedControlID="tbState" Text="State:"></asp:Label>   &nbsp;</td>
     <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox

ID="tbState" runat="server" Width="190px"></asp:TextBox>  </span> </td>
     <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span

style="color: red">*</span>&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator7"

runat="server" ControlToValidate="tbState" Display="Dynamic" ErrorMessage="State is required"

EnableClientScript="true" SetFocusOnError="true"></asp:RequiredFieldValidator>     </td>
       </tr>
       
        <tr>
     <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label10"

runat="server" AssociatedControlID="tbZip" Text="Zip Code:"></asp:Label>  &nbsp;</td>
     <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbZip"

runat="server" Width="190px"></asp:TextBox>  </span> </td>
     <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span

style="color: red">*</span>&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator8"

runat="server" ControlToValidate="tbZip" ErrorMessage="Zip Code is required" Display="Dynamic"

EnableClientScript="true" SetFocusOnError="true"></asp:RequiredFieldValidator>     </td>
       </tr>
     
     
     
     
     <tr>
   <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label5"

runat="server" AssociatedControlID="tbPhone" Text="Phone #:"></asp:Label>&nbsp;&nbsp;</td>
   <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbPhone"

runat="server" Width="190px"></asp:TextBox></span> </td>
   <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color:

red">*</span>&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"

ControlToValidate="tbPhone" ErrorMessage="Phone is required" Display="Dynamic"

EnableClientScript="true" SetFocusOnError="true"></asp:RequiredFieldValidator></td></tr>
   
    <tr>
     <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label11"

runat="server" AssociatedControlID="tbCellPhone" Text="Cell Phone #:"></asp:Label>  &nbsp;</td>
     <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox

ID="tbCellPhone" runat="server" Width="190px"></asp:TextBox> </span> </td>
     <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%">&nbsp;     </td>
       </tr>
       
       <tr>
   <td style="text-align: right; white-space: nowrap; width: 30%"><asp:Label ID="Label4"

runat="server" AssociatedControlID="tbEmail" Text="Email:"></asp:Label>&nbsp;&nbsp;</td>
   <td style="text-align: left; white-space: nowrap; width: 25%"><span><asp:TextBox ID="tbEmail"

runat="server" Width="190px"></asp:TextBox></span></td>
   
   <td colspan="2" style="text-align: left; white-space: nowrap; width: 20%"><span style="color:

red">*</span>&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server"

ControlToValidate="tbEmail" ErrorMessage="Email is required" Display="Dynamic"

EnableClientScript="true" SetFocusOnError="true"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="tbEmail"

ValidationExpression="^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA

-Z\.]*[a-zA-Z]$" Display="Dynamic" ErrorMessage="Enter Valid

e-mail"></asp:RegularExpressionValidator>
   
   
   </td></tr>
   
   
   
   
   
    <tr>
  <td colspan="4" style="width:100%" valign="top" align="center">&nbsp; </td>
  </tr>
  <tr>
  <td colspan="4" style="width:100%" valign="top" align="center"><hr /> </td>
  </tr>
     <tr>
  <td colspan="4" style="width:100%" valign="top" align="center">&nbsp; </td>
  </tr>
  <tr>
  <td colspan="4" style="width:100%" valign="top" align="left"><strong><span

style="color:crimson">Workshop Information</span></strong><br /> </td>
  </tr>
  <tr>
  <td colspan="4" style="width:100%" valign="top" align="center">&nbsp;&nbsp; </td>
  </tr>
   
   <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%">
 
&nbsp;


    </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span>

<table cellpadding="0" cellspacing="0" style="border-color:gray" border="0">
<tr>
<td>

<rsvpcheckbox>
<span>

<HGACServerControls:RSVPCheckBoxControl ID="DateofWorkshopOne" runat="server" QuantityText="Admit One" ChargeAmount="25.00"  BackColor="Bisque"  Font-Size="X-Small" ToolTip="Click to Select This Date " Enabled="true" Text="Workshop One Date: April 23, 2010" CheckBoxLabel="Workshop One Selected"  />



</span>
</rsvpcheckbox>
 

<asp:CheckBox ID="Workshop_One_Date" runat="server" AutoPostBack="false" OnCheckedChanged="CheckBox1_CheckedChanged"  Text=" " />

 <asp:Label ID="lblWorkshop_01" runat="server" AssociatedControlID="Workshop_One_Date" Text=" " BackColor="Gray"></asp:Label>


</td>
<td>
   
    &nbsp;



</td>
</tr>
</table>


</span>  

 </td>
 </tr>

   
 
  <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">Workshop 1:&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="color:#4b8a08; font-size:11px">Local Official’s Guide to

Coastal Construction</span></td>
 </tr>
  <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">Date:&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="color:#08088a; font-size:11px">Friday, April 23,

2010</span></td>
 </tr>
   <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">Time:&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="font-size:11px">8:00 am – 5:00 pm</span></td>
 </tr>
  <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">Location:&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="font-size:11px"><a class="null" title="Directions Community

Resource Center" href="http://www.unitedwayhouston.org/default/pdfs/uw_directions.pdf">United

Way<br />Community Resource Center</a><br />
50 Waugh Drive<br />
Houston, TX 77007</span></td>
 </tr>
   <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">Cost:&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="font-size:11px">There is no fee for this

workshop.</span></td>
 </tr>
 
 
 
  <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="font-size:11px">&nbsp; </span></td>
 </tr>

 

  <tr>
  <td colspan="4" style="width:100%" valign="top" align="center"><hr /> </td>
  </tr>
 
  <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%">
&nbsp;
   </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span>
<table cellpadding="0" cellspacing="0" style="border-color:gray" border="0">
<tr>
<td>


<rsvpcheckbox>
<span>

<HGACServerControls:RSVPCheckBoxControl ID="DateofWorkshopTwo" runat="server" QuantityText="Admit One" ChargeAmount="25.00" BackColor="Bisque"  Font-Size="X-Small" ToolTip="Click to Select This Date " Enabled="true" Text="Workshop One Date: May 11, 2010"  />

</span>
</rsvpcheckbox>

<br />

<asp:CheckBox ID="Workshop_Two_Date" runat="server" AutoPostBack="false" OnCheckedChanged="CheckBox2_CheckedChanged" />

 <asp:Label ID="lblWorkshop_02" runat="server" AssociatedControlID="Workshop_Two_Date" Text=" " BackColor="Gray"></asp:Label>
</td>
<td>
&nbsp;

</td>

</tr>
 
 
</table>

</td>
 </tr>
   
 
  <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">Workshop 2:&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="color:#4b8a08; font-size:11px">Coastal Construction

Workshop for Homebuilders and <br />
Introduction to Coastal Foundation Design and Construction for Local Officials
</span></td>
 </tr>
 <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">Date:&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="color:#08088a; font-size:11px">Tuesday, May 11,

2010</span></td>
 </tr>
 <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">Time:&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="font-size:11px">8:00 am – 5:00 pm</span></td>
 </tr>
  <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">Location:&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="font-size:11px"><a class="null" title="Directions to H-GAC"

href="http://www.h-gac.com/contact/Map/default.aspx">Houston-Galveston Area Council</a><br />
3555 Timmons Lane</a><br />
2nd Floor Conference Room A, Suite 120<br />
Houston, TX 77027</span></td>
 </tr>
   <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">Cost:&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="font-size:11px">There is no fee for this

workshop.</span></td>
 </tr>
   <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%"><span

style="font-size:11px">&nbsp;&nbsp;</span> </td>
   <td colspan="3" style="text-align: left; vertical-align:top; width: 70%;

background-color:white"><span style="font-size:11px">&nbsp; </span></td>
 </tr>
 <tr>
  <td colspan="4" style="width:100%" valign="top" align="center"><hr /> </td>
  </tr>
<tr>
  <td colspan="4" style="width:100%" valign="top" align="center">&nbsp;&nbsp; </td>
  </tr>
    <tr>
   <td style="text-align: right; vertical-align:top; white-space: nowrap; width: 30%">
<asp:Label ID="Label7" runat="server" Text="Your Comments:&nbsp;&nbsp;"

AssociatedControlID="tbComments"></asp:Label></td>    
       <td colspan="3" style="text-align: left;  width: 70%"><span>
 <asp:TextBox ID="tbComments" runat="server" TextMode="MultiLine" Height="80"

Width="90%"></asp:TextBox>
 </td>
     </tr>
    </table>    
         
</AdditionalFormControls>
</HGACServerControls:RSVPForm>

------------
Thank you for your help.

0
LotokCommented:
Can you clarify from the above which markup/code controls the email being sent? Which controls and code belongs to that email?
I am trying to work out from your code what is preventing you just creating a label and putting the dates etc on there and where the code is saying what information the email shows. Such as the true or false output.
0
Codeaddict7423Author Commented:
Lotok:

I got a solution working.  I stripped away the old code and replaced with a clean copy of  your suggestion for changing the ID of the checkbox and it worked. Now the return is like this:
--------
First Name: test-33_luis
Last Name: test-33_hernandez
Title: test-33_test
Organization: test-33_hgac
Address: test-33_3555 TIMMONS
City: test-33_houston
State: test-33_tx
Zip Code: test-33_77027
Phone #: 7136547879
Cell Phone #: 7136541454
Email: luis.hernandez@h-gac.com
Date of Workshop Selected: April 23, 2010: True
Date of Workshop Selected: May 11, 2010: True
Your Comments: : test-33_this is fema test with both checkboxes ids changed to string stating the date of the workshop selected.
-------

I'm  happy with the return. however, if i remember right,  you're telling me that the "true" or "false" return can't be changed. Is that correct?

0
Codeaddict7423Author Commented:
Lotok:
I'm almost there....  the code you suggested is working when checkbox is selected but when not selected it returns only a "false".  can you please review my code:
---------
<script runat="server">
    Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Workshop_One_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_One_Date"), CheckBox)

        Dim lblWorkshop_01 As Label = CType(RSVPForm1.FindControl("lblWorkshop_01"), Label)
        lblWorkshop_01.Visible = "false"
         
        If Workshop_One_Date.Checked = True Then
 
            lblWorkshop_01.Visible = "true"
   
            lblWorkshop_01.Text = "Date of Workshop: April 23, 2010"
            'Workshop_One_Date.Visible = "true"
           
            Workshop_One_Date.ID = "Date of Workshop Selected: April 23, 2010"
                 
        Else
            Workshop_One_Date.Text = "Not Selected "

            lblWorkshop_01.Visible = "false"
            lblWorkshop_01.Text = "Date of Workshop Not Selected: April 23, 2010"
           
            'Workshop_One_Date.Visible = "false"
            Workshop_One_Date.ID = "Date of Workshop Selected: April 23, 2010"
        End If
    End Sub
</script>
-----------
0
LotokCommented:
Try this. You had the id being changed to the same thing regardless of the true or false outcome.

Dim Workshop_One_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_One_Date"), CheckBox)

        Dim lblWorkshop_01 As Label = CType(RSVPForm1.FindControl("lblWorkshop_01"), Label)
        lblWorkshop_01.Visible = "false"
          
        If Workshop_One_Date.Checked = True Then
  
            lblWorkshop_01.Visible = "true"
    
            lblWorkshop_01.Text = "Date of Workshop: April 23, 2010"
            'Workshop_One_Date.Visible = "true"
            
            Workshop_One_Date.ID = "Date of Workshop Selected: April 23, 2010"
                 
        Else
            Workshop_One_Date.Text = "Not Selected "

            lblWorkshop_01.Visible = "false"
            lblWorkshop_01.Text = "Date of Workshop Not Selected: April 23, 2010"
            
            'Workshop_One_Date.Visible = "false"
            Workshop_One_Date.ID = "Not Selected "
        End If

Open in new window

0
LotokCommented:
Oh just noticed you also did this:
'Workshop_One_Date.Visible = "false"

if you hide the control completely there will be nothing to show, the control needs to be visible.

You will want

'Workshop_One_Date.Visible = "True"
0
Codeaddict7423Author Commented:
Lotok:
Thank you for the quck catch.
When i do not select the first checkbox, i get a "Label: false"....  below is my sub with your suggestion
-----------
Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Workshop_One_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_One_Date"), CheckBox)
 
        Dim lblWorkshop_01 As Label = CType(RSVPForm1.FindControl("lblWorkshop_01"), Label)
        lblWorkshop_01.Visible = "false"
           
        If Workshop_One_Date.Checked = True Then
   
            lblWorkshop_01.Visible = "true"
     
            lblWorkshop_01.Text = "Date of Workshop: April 23, 2010"
            'Workshop_One_Date.Visible = "true"
             
            Workshop_One_Date.ID = "Date of Workshop Selected: April 23, 2010"
                 
        Else
            Workshop_One_Date.Text = "Not Selected "
 
            lblWorkshop_01.Visible = "false"
            lblWorkshop_01.Text = "Date of Workshop Not Selected: April 23, 2010"
             
            Workshop_One_Date.Visible = "true"
            Workshop_One_Date.ID = "Not Selected "
        End If

    End Sub
---------
0
LotokCommented:
Post the form output like you did above, showing test info
0
Codeaddict7423Author Commented:
Lotok:
here's the form output:
-------
First Name: test-43_luis
Last Name: test-43_hernandez
Title: test-43_test
Organization: test-43_hgac
Address: test-43_3555
City: test-43_houston
State: test-43_tx
Zip Code: test-43_77027
Phone #: 7136547987
Cell Phone #: 713654797
Email: luis.hernandez@h-gac.com
Label: False
Date of Workshop Selected: May 11, 2010: True
Your Comments:  : test-43_april 23 not selected and may 11 selected

---------
0
Codeaddict7423Author Commented:
Lotok:
I cleaned my subs and thought i'd post those for your review.
------
<script runat="server">
    Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Workshop_One_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_One_Date"), CheckBox)
        Dim lblWorkshop_01 As Label = CType(RSVPForm1.FindControl("lblWorkshop_01"), Label)
        lblWorkshop_01.Visible = "false"
           
        If Workshop_One_Date.Checked = True Then
            lblWorkshop_01.Visible = "true"
            lblWorkshop_01.Text = "Date of Workshop: April 23, 2010"
            'Workshop_One_Date.Visible = "true"          
            Workshop_One_Date.ID = "Date of Workshop Selected: April 23, 2010"
        Else
            Workshop_One_Date.Text = "Not Selected "
            lblWorkshop_01.Visible = "false"
            lblWorkshop_01.Text = "Date of Workshop Not Selected: April 23, 2010"    
            Workshop_One_Date.Visible = "true"
            Workshop_One_Date.ID = "Not Selected "
        End If

    End Sub
</script>

<script runat="server">
    Protected Sub CheckBox2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Workshop_Two_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_Two_Date"), CheckBox)  
        Dim lblWorkshop_02 As Label = CType(RSVPForm1.FindControl("lblWorkshop_02"), Label)
        lblWorkshop_02.Visible = "false"
       
        If Workshop_Two_Date.Checked = True Then      
            lblWorkshop_02.Visible = "true"
            lblWorkshop_02.Text = "Date of Workshop: May 11, 2010"
            'Workshop_Two_Date.Visible = "true"
            Workshop_Two_Date.ID = "Date of Workshop Selected: May 11, 2010"
        Else
            Workshop_Two_Date.Text = "Not Selected "
            lblWorkshop_02.Visible = "false"
            lblWorkshop_02.Text = "Date of Workshop Not Selected: May 11, 2010"
            Workshop_Two_Date.Visible = "true"
            Workshop_Two_Date.ID = "Not Selected"
           
        End If
    End Sub
</script>
-------
0
LotokCommented:
Try this:
   Dim Workshop_One_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_One_Date"), CheckBox)
 
        Dim lblWorkshop_01 As Label = CType(RSVPForm1.FindControl("lblWorkshop_01"), Label)
        lblWorkshop_01.Visible = "false"
           
        If Workshop_One_Date.Checked = True Then
   
            lblWorkshop_01.Visible = "true"
     
            lblWorkshop_01.Text = "Date of Workshop: April 23, 2010"
            'Workshop_One_Date.Visible = "true" 
             
            Workshop_One_Date.ID = "Date of Workshop Selected: April 23, 2010"
                  
        Else
            Workshop_One_Date.Text = "Not Selected "
 
            lblWorkshop_01.Visible = "True"
            lblWorkshop_01.Text = "Not Selected"
             
            Workshop_One_Date.Visible = "true"
            Workshop_One_Date.ID = "Not Selected "
        End If

Open in new window

0
LotokCommented:
From the output I think you have some redundant code there.
Try this also:
   Dim Workshop_One_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_One_Date"), CheckBox)
 
        Dim lblWorkshop_01 As Label = CType(RSVPForm1.FindControl("lblWorkshop_01"), Label)
        lblWorkshop_01.Visible = "false"
           
        If Workshop_One_Date.Checked = True Then
   
            lblWorkshop_01.Visible = "true"
     
            lblWorkshop_01.Text = "Date of Workshop: April 23, 2010"
                  
        Else
 
            lblWorkshop_01.Visible = "True"
            lblWorkshop_01.Text = "Not Selected"
             
        End If

Open in new window

0
Codeaddict7423Author Commented:
Lotok:
below is my s ub for checkbox one
----
<script runat="server">
    Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Workshop_One_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_One_Date"), CheckBox)
 
        Dim lblWorkshop_01 As Label = CType(RSVPForm1.FindControl("lblWorkshop_01"), Label)
        lblWorkshop_01.Visible = "false"
           
        If Workshop_One_Date.Checked = True Then
   
            lblWorkshop_01.Visible = "true"
     
            lblWorkshop_01.Text = "Date of Workshop: April 23, 2010"
                   
        Else
 
            lblWorkshop_01.Visible = "True"
            lblWorkshop_01.Text = "Not Selected"            
        End If
    End Sub
</script>
---------

below is my output
------------
First Name: test-44_luis
Last Name: test-44_hernandez
Title: test-44_TEST
Organization: test-44_hgac
Address: test-44_35555
City: test-44_houston
State: test-44_tx
Zip Code: test-44_770207
Phone #: 7136547878
Cell Phone #: 7136547878
Email: luis.hernandez@h-gac.com
Label: False
Date of Workshop Selected: May 11, 2010: True
Your Comments:  : test-44_april 23 not selected and may 11 selected

-----
0
LotokCommented:
if you check the box and then uncheck it, then see the output.
I have a hunch that it will change, if it does, its because the checkbox didnt change, on the other tests. none of the checkedchanged code took place for that checkbox.

A solution to that is a checkboxlist rather than 2 checkboxes and put the code in indexchanged.

 OR

have the event dates in the labels by default (like below). then you will just get a true beside the selected one and a false beside the one that wasnt selected.

I need to goto sleep, I will check back in about 7 hrs to see how it went.
<asp:Label ID="lblWorkshop_01" runat="server" AssociatedControlID="Workshop_One_Date" Text="Date of Workshop Selected: May 11, 2010" BackColor="Gray"></asp:Label>

Open in new window

0
Codeaddict7423Author Commented:
Lotok:
Thank you
I'll let you know progress
0
LotokCommented:
success?
0
Codeaddict7423Author Commented:
Lotok:
Thank you for all your help. My returns look like this:
----
First Name: test-51_luis
Last Name: test-51_hernandez
Title: test-51_test
Organization: test-51_hgac
Address: test-51_3555
City: test-51_houston
State: test-51_tx
Zip Code: test-51_77027
Phone #: 77346789797
Cell Phone #: 7136547878
Email: luis.hernandez@h-gac.com
Date of Workshop Selected: April 23, 2010: True
Date Not Selected: May 11, 2010: False
Your Comments:  : test-51_ april 23 selected and may 11 not selected
--------
and when both checkboxes are selected:
-------
Date of Workshop Selected: April 23, 2010: True
Date of Workshop Selected: May 11, 2010: True
Your Comments: : test-52_ april 23 selected and may 11 selected
------
THANK you again for all your help.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LotokCommented:
Did you go with one of the options from above? which one?
All sorted?
0
Codeaddict7423Author Commented:
Lotok:
Yes, i followed your suggestion and this is my sub  below:
-------
<script runat="server">
    Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Workshop_One_Date As CheckBox = CType(RSVPForm1.FindControl("Workshop_One_Date"), CheckBox)
 
        Dim lblWorkshop_01 As Label = CType(RSVPForm1.FindControl("lblWorkshop_01"), Label)
        lblWorkshop_01.Visible = "false"
           
        If Workshop_One_Date.Checked = True Then
            lblWorkshop_01.Visible = "true"
            lblWorkshop_01.Text = "Date of Workshop Selected: April 23, 2010"
            'Workshop_One_Date.Visible = "true"
            Workshop_One_Date.ID = "Date of Workshop Selected: April 23, 2010"
                   
        Else
 
            lblWorkshop_01.Visible = "True"
            lblWorkshop_01.Text = "Not Selected"
            Workshop_One_Date.Visible = "true"
            Workshop_One_Date.ID = "Not Selected"
             
        End If


    End Sub
</script>
----------
this generates a return like this:
---------
First Name: test-52_luis
Last Name: test-52_hernandez
Title: test-52_test
Organization: test-52_hgac
Address: test-52_3555
City: test-52_houston
State: test-52_tx
Zip Code: test-52_77027
Phone #: 7136547878
Cell Phone #: 7136567887
Email: luis.hernandez@h-gac.com
Date of Workshop Selected: April 23, 2010: True
Date of Workshop Selected: May 11, 2010: True
Your Comments: : test-52_ april 23 selected and may 11 selected
--------

It's just like you suggested. Thank you.
0
LotokCommented:
Thanks, glad it all worked out.
Take it easy.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.