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

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

devnewbeeAsked:
Who is Participating?
 
ALaRivaCommented:
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
 
devnewbeeAuthor Commented:
This works, but if I insert on the next step, it inserts both value as "True".  What can I do?
0
 
Anurag ThakurTechnical ManagerCommented:
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
 
devnewbeeAuthor Commented:
Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.