[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

String was not recognized as a valid Boolean..Please Help

Posted on 2009-04-28
4
Medium Priority
?
784 Views
Last Modified: 2013-12-17
String was not recognized as a valid Boolean..Please Help.


<asp:Content ID="Content1" ContentPlaceHolderID="cphContent" runat="Server">
    <tr>
        <td>
            <asp:Wizard ID="psWizard" runat="server" Width="100%" CellPadding="4" CellSpacing="4"
                BackColor="#F7F6F3" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"
                Font-Names="Verdana" Font-Size="0.8em" ActiveStepIndex="1" EnableViewState="False">
                <StepStyle BorderWidth="0px" ForeColor="#5D7B9D" />
                <WizardSteps>
                    <asp:WizardStep runat="server" Title="Step 1">
                        <table style="width: 100%;">
                            <tr>
                                <td align="left" style="width: 706px">
                                    Welcome!                                </td>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td align="left" colspan="3">
                                    Thank you for your time and we look forward to serving you.
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 706px">
                                    Here is how it works.<br />
                                    <br />
                                    1.&nbsp; Click the &quot;Next&quot; button to begin.<br />
                                    2.&nbsp; Click
                                    <asp:Button ID="btnBringItems" runat="server" Text="Here" />
                                    &nbsp;to see if you need any additional items before you begin.
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                        </table>
                        <br />
                    </asp:WizardStep>
                    <asp:WizardStep runat="server" Title="Step 2">
                        <div id="firsttable">
                            <table style="width: 100%" bgcolor="WhiteSmoke">
                                <tr>
                                    <td align="left" colspan="2">
                                        &nbsp;
                                        <asp:SqlDataSource ID="dsInsert" runat="server" ConnectionString="<%$ ConnectionStrings:pre-screenConnectionString %>"
                                            InsertCommand="usp_Inserttest" InsertCommandType="StoredProcedure" SelectCommand="select * from test">
                                            <InsertParameters>
                                                <asp:ControlParameter ControlID="ddVet" Name="Veteran" PropertyName="SelectedValue"
                                                    Type="Boolean" />
                                                <asp:ControlParameter ControlID="ddCollege" Name="College" PropertyName="SelectedValue"
                                                    Type="Boolean" />
                                                <asp:Parameter Direction="InputOutput" Name="ID" Type="Int32" />
                                            </InsertParameters>
                                        </asp:SqlDataSource>
                                    </td>
                                </tr>
                                <tr class="btnav" onmouseover="style.backgroundColor='Beige';" onmouseout="style.backgroundColor='#F5F5F5'">
                                    <td style="width: 574px; height: 32px;">
                                        Veteran?
                                    </td>
                                    <td style="height: 32px">
                                        &nbsp;
                                        <asp:DropDownList ID="ddVet" runat="server" AutoPostBack="True">
                                            <asp:ListItem Value="Yes">Yes</asp:ListItem>
                                            <asp:ListItem Value="No">No</asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                                <tr class="btnav" onmouseover="style.backgroundColor='Beige';" onmouseout="style.backgroundColor='#F5F5F5'">
                                    <td style="width: 574px">
                                        College?
                                    </td>
                                    <td>
                                        &nbsp;
                                        <asp:DropDownList ID="ddCollege" runat="server" AutoPostBack="True">
                                            <asp:ListItem Value="Yes">Yes</asp:ListItem>
                                            <asp:ListItem Value="No">No</asp:ListItem>
                                        </asp:DropDownList>
                                        <br />
                                    </td>
                                </tr>
                                <tr class="btnav" onmouseout="style.backgroundColor='#F5F5F5'" 
                                    onmouseover="style.backgroundColor='Beige';">
                                    <td style="width: 574px">
                                        &nbsp;</td>
                                    <td>
                                        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <br />
                    </asp:WizardStep>
                </WizardSteps>
                <SideBarButtonStyle BorderWidth="0px" Font-Names="Verdana" ForeColor="White" Width="35px" />
                <NavigationButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid"
                    BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" />
                <SideBarStyle BackColor="#B9A180" BorderWidth="0px" Font-Size="0.9em" VerticalAlign="Top" />
                <HeaderStyle BackColor="#5D7B9D" BorderStyle="Solid" Font-Bold="True" Font-Size="0.9em"
                    ForeColor="White" HorizontalAlign="Left" />
            </asp:Wizard>
        </td>
    </tr>
</asp:Content>
*********************************************************
 
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void Button1_Click(object sender, EventArgs e)
    {
        dsInsert.Insert();
    }
}

Open in new window

0
Comment
Question by:devnewbee
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
ALaRiva earned 1600 total points
ID: 24251777
The problem is here:
<asp:DropDownList ID="ddCollege" runat="server" AutoPostBack="True">
    <asp:ListItem Value="Yes">Yes</asp:ListItem>
    <asp:ListItem Value="No">No</asp:ListItem>
</asp:DropDownList>

You need change the values from Yes/No to True/False compatible values. - >  1/0 or True/False
0
 

Author Comment

by:devnewbee
ID: 24251908
This works, but if I insert on the next step, it inserts both value as "True".  What can I do?
0
 
LVL 26

Assisted Solution

by:Anurag Thakur
Anurag Thakur earned 400 total points
ID: 24251976
try this

<asp:DropDownList ID="ddCollege" runat="server" AutoPostBack="True">
    <asp:ListItem Value="1">True</asp:ListItem>
    <asp:ListItem Value="0">False</asp:ListItem>
</asp:DropDownList>
0
 

Author Closing Comment

by:devnewbee
ID: 31575513
Thank you!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question