Solved

FormView CheckBoxList / ListBox Problems

Posted on 2006-06-21
6
902 Views
Last Modified: 2008-01-09
I am using a FormView that has several CheckBoxLists and ListBoxes.

When I do an insert only the first selected value gets inserted?  What am I doing wrong?
0
Comment
Question by:alivemedia
  • 3
  • 2
6 Comments
 
LVL 12

Expert Comment

by:fruhj
ID: 16955568
Wow, this question is just begging for SARCASM!!!!

Q:"What am I doing wrong?"
A:"You didn't include even close to enough information in your question!"

Seriously,

 Please give us more to work with.

 Remeber that movie with Tom Cruse?
 "Help me, help you"

  Post some more detail, source code would be idea...
0
 
LVL 2

Author Comment

by:alivemedia
ID: 16956002
O.K., here's my code (I removed the ItemTemplate, UpdateTemplate becuase the source was so long):

Any time you do an insert if you choose more than 1 item in a checkboxlist control or ListBox control only the first selected item actually gets inserted into the database.

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Property.ascx.vb" Inherits="UserControls_Property" %>
<h1><asp:Label ID="Header" runat="server" Text="Header" /></h1>
<asp:FormView ID="FormView1" runat="server" DataKeyNames="PropertyId" DataSourceID="SqlDataSource1" Width="100%">
        <InsertItemTemplate>
        <label>&nbsp;</label><label  class="required">Required Fields In Red</label><br />
        <asp:HiddenField ID="UserId" runat="server" Value='<%# Request.Cookies("UserId").Value %>'  />
        <label class="required">Owners Name:</label> <asp:TextBox ID="OwnersNameTextBox" runat="server" Text='<%# Bind("OwnersName") %>' />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="OwnersNameTextBox"  SetFocusOnError="true" /><br />
       
        <label class="required">Address:</label><asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>' />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="AddressTextBox" SetFocusOnError="true" /><br />
       
        <label>Address 2:</label><asp:TextBox ID="Address2TextBox" runat="server" Text='<%# Bind("Address2") %>'/><br />
        <label class="required">City:</label> <asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>'/>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="CityTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Zip:</label><asp:TextBox ID="ZipTextBox" runat="server" Text='<%# Bind("Zip") %>'/>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="ZipTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">County:</label><asp:DropDownList ID="CountyTextBox" runat="server" SelectedValue='<%# Bind("County") %>' DataSourceID="CountiesDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="CountyTextBox" SetFocusOnError="true" /><br />
       
        <label>State:</label><asp:DropDownList ID="StateTextBox" runat="server" DataSourceID="StatesDataSource" DataTextField="Text" DataValueField="Value" SelectedValue='<%# Bind("State") %>'/><br />
       
        <label class="required">Home Phone:</label><asp:TextBox ID="HomePhoneTextBox" runat="server" Text='<%# Bind("HomePhone") %>' />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="HomePhoneTextBox" SetFocusOnError="true" /><br />
       
        <label>Preffered Number:</label><asp:TextBox ID="PrefferedNumberTextBox" runat="server" Text='<%# Bind("PrefferedNumber") %>' /><br />
        <label class="required">EmailAddress:</label><asp:TextBox ID="EmailAddressTextBox" runat="server" Text='<%# Bind("EmailAddress") %>' />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="EmailAddressTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">List Price:</label><asp:TextBox ID="ListPriceTextBox" runat="server" Text='<%# Bind("ListPrice") %>' />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="ListPriceTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Type Of Home:</label><asp:DropDownList ID="TypeOfHomeTextBox" runat="server" SelectedValue='<%# Bind("TypeOfHome") %>' DataSourceID="TypeHomeSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TypeOfHomeTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Bedrooms:</label><asp:DropDownList ID="BedroomsTextBox" runat="server" SelectedValue='<%# Bind("Bedrooms") %>' DataSourceID="zeroto5" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="BedroomsTextBox" SetFocusOnError="true" /><br />

        <label class="required">Full Baths:</label><asp:DropDownList ID="FullBathsTextBox" runat="server" SelectedValue='<%# Bind("FullBaths") %>' DataSourceID="zeroto5" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="FullBathsTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Half Baths:</label><asp:DropDownList ID="HalfBathsTextBox" runat="server" SelectedValue='<%# Bind("HalfBaths") %>' DataSourceID="zeroto5" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator13" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="HalfBathsTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Year Built:</label><asp:TextBox ID="YearBuiltTextBox" runat="server" Text='<%# Bind("YearBuilt") %>' />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="YearBuiltTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Living Area Under Air:</label><asp:TextBox ID="LivingAreaUnderAirTextBox" runat="server" Text='<%# Bind("LivingAreaUnderAir") %>' />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator14" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="LivingAreaUnderAirTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Total Area:</label><asp:TextBox ID="TotalAreaTextBox" runat="server" Text='<%# Bind("TotalArea") %>' />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator15" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TotalAreaTextBox" SetFocusOnError="true" /><br />
       
       <h2>Room Dimensions (Example: 12 x 14 - in feet, please round)</h2>
       <hr />
        <label class="required">Living Room:</label><asp:TextBox ID="LivingRoomTextBox" runat="server" Text='<%# Bind("LivingRoom") %>' />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="LivingRoomTextBox" SetFocusOnError="true" /><br />
       
        <label>Dining Room:</label><asp:TextBox ID="DiningRoomTextBox" runat="server" Text='<%# Bind("DiningRoom") %>' /><br />
        <label>Dining Area:</label><asp:TextBox ID="DiningAreaTextBox" runat="server" Text='<%# Bind("DiningArea") %>' /><br />
        <label class="required">Kitchen:</label><asp:TextBox ID="KitchenTextBox" runat="server" Text='<%# Bind("Kitchen") %>' />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator17" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="KitchenTextBox" SetFocusOnError="true" /><br />
       
        <label>Family Room:</label><asp:TextBox ID="FamilyRoomTextBox" runat="server" Text='<%# Bind("FamilyRoom") %>' /><br />
        <label>Florida Room:</label><asp:TextBox ID="FloridaRoomTextBox" runat="server" Text='<%# Bind("FloridaRoom") %>' /><br />
        <label class="required">Master Bedroom:</label><asp:TextBox ID="MasterBedroomTextBox" runat="server" Text='<%# Bind("MasterBedroom") %>' />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator18" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="MasterBedroomTextBox" SetFocusOnError="true" /><br />
       
        <label>Bedroom 2:</label><asp:TextBox ID="Bedroom2TextBox" runat="server" Text='<%# Bind("Bedroom2") %>' /><br />
        <label>Bedroom 3:</label><asp:TextBox ID="Bedroom3TextBox" runat="server" Text='<%# Bind("Bedroom3") %>' /><br />
        <label>Bedroom 4:</label><asp:TextBox ID="Bedroom4TextBox" runat="server" Text='<%# Bind("Bedroom4") %>' /><br />
        <label>Bedroom 5:</label><asp:TextBox ID="Bedroom5TextBox" runat="server" Text='<%# Bind("Bedroom5") %>' /><br />
        <label>Den:</label><asp:TextBox ID="DenTextBox" runat="server" Text='<%# Bind("Den") %>' /><br />
        <label>Porch:</label><asp:TextBox ID="PorchTextBox" runat="server" Text='<%# Bind("Porch") %>' /><br />
        <label>Utility Laundry:</label><asp:TextBox ID="UtilityLaundryTextBox" runat="server" Text='<%# Bind("UtilityLaundry") %>' /><br />
        <label>Patio Balcony:</label><asp:TextBox ID="PatioBalconyTextBox" runat="server" Text='<%# Bind("PatioBalcony") %>' /><br />
        <hr />
       
        <label class="required">Garage:</label><asp:DropDownList ID="GarageTextBox" runat="server" SelectedValue='<%# Bind("Garage") %>' DataSourceID="GarageDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator19" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="GarageTextBox" SetFocusOnError="true" /><br />
       
        <label>Garage Attached:</label><asp:DropDownList ID="DropDownList7" runat="server" SelectedValue='<%# Bind("GarageAttached") %>' DataSourceID="YesNoDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Carport:</label><asp:DropDownList ID="DropDownList8" runat="server" SelectedValue='<%# Bind("Carport") %>' DataSourceID="CarportDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Carport Attached:</label><asp:DropDownList ID="DropDownList9" runat="server" SelectedValue='<%# Bind("CarportAttached") %>' DataSourceID="YesNoDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Parking Description:</label><asp:DropDownList ID="DropDownList10" runat="server" SelectedValue='<%# Bind("ParkingDescription") %>' DataSourceID="ParkingDescriptionDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Parking Restrictions:</label><asp:DropDownList ID="DropDownList11" runat="server" SelectedValue='<%# Bind("ParkingRestrictions") %>' DataSourceID="ParkingRestrictionsDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label class="required">Homeowners Assoc:</label><asp:DropDownList ID="HomeownersAssocTextBox" runat="server" SelectedValue='<%# Bind("HomeownersAssoc") %>' DataSourceID="YesNoDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator20" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="HomeownersAssocTextBox" SetFocusOnError="true" /><br />
       
        <label>Maintenence Fee:</label><asp:TextBox ID="MaintenenceFeeTextBox" runat="server" Text='<%# Bind("MaintenenceFee") %>' /><br />
        <label>Maintenence Paid:</label><asp:DropDownList ID="DropDownList14" runat="server" SelectedValue='<%# Bind("MaintenencePaid") %>' DataSourceID="MaintenancePaidDataSource" DataTextField="Text" DataValueField="Text" /><br />
       
        <label>Maintenance Includes:</label>
        <asp:ListBox ID="ListBox1" runat="server" DataSourceID="MaintenanceDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("MaintenanceIncludes") %>'  SelectionMode="Multiple"/><br />
       
        <label>Community Restrictions:</label><asp:CheckBoxList ID="CheckBoxList2" runat="server" DataSourceID="RestrictionsDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("CommunityRestrictions") %>' /><br />
         
        <label>Pets Allowed:</label><asp:DropDownList ID="DropDownList15" runat="server" SelectedValue='<%# Bind("PetsAllowed") %>' DataSourceID="YesNoDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Pet Restrictions:</label><asp:TextBox ID="PetRestrictionsTextBox" runat="server" Text='<%# Bind("PetRestrictions") %>' /><br />
        <label>Subdivision Amenities:</label><asp:CheckBoxList ID="CheckBoxList3" runat="server" DataSourceID="AmenitiesDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("SubdivisionAmenities") %>' /><br />
       
        <label class="required">Special Assesments:</label><asp:DropDownList ID="SpecialAssesmentsTextBox" runat="server" SelectedValue='<%# Bind("SpecialAssesments") %>' DataSourceID="YesNoDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator21" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="SpecialAssesmentsTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Waterfront Property:</label><asp:DropDownList ID="WaterfrontPropertyTextBox" runat="server" SelectedValue='<%# Bind("WaterfrontProperty") %>' DataSourceID="YesNoDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator22" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="WaterfrontPropertyTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Waterfront Description:</label><asp:DropDownList ID="WaterfrontDescriptionTextBox" runat="server" SelectedValue='<%# Bind("WaterfrontDescription") %>' DataSourceID="WaterFrontDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator23" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="WaterfrontDescriptionTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Ocean Access:</label><asp:DropDownList ID="OceanAccessTextBox" runat="server" SelectedValue='<%# Bind("OceanAccess") %>' DataSourceID="YesNoDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator24" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="OceanAccessTextBox" SetFocusOnError="true" /><br />
       
        <label>Dockage Type:</label><asp:DropDownList ID="DropDownList20" runat="server" SelectedValue='<%# Bind("DockageType") %>' DataSourceID="DockageDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label class="required">Direction Home Faces:</label><asp:DropDownList ID="DirectionHomeFacesTextBox" runat="server" SelectedValue='<%# Bind("DirectionHomeFaces") %>' DataSourceID="DirectionDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator25" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="DirectionHomeFacesTextBox" SetFocusOnError="true" /><br />
       
        <label>Private Pool:</label><asp:DropDownList ID="DropDownList22" runat="server" SelectedValue='<%# Bind("PrivatePool") %>' DataSourceID="YesNoDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Type Of Pool:</label><asp:DropDownList ID="DropDownList23" runat="server" SelectedValue='<%# Bind("TypeOfPool") %>' DataSourceID="TypeOfPoolDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Design Of Home:</label><asp:DropDownList ID="DropDownList24" runat="server" SelectedValue='<%# Bind("DesignOfHome") %>' DataSourceID="DesignDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label class="required">Construction Of Home:</label><asp:DropDownList ID="ConstructionOfHomeTextBox" runat="server" SelectedValue='<%# Bind("ConstructionOfHome") %>' DataSourceID="ConstrictionDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator26" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="ConstructionOfHomeTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Lot Description:</label><asp:DropDownList ID="LotDescriptionTextBox" runat="server" SelectedValue='<%# Bind("LotDescription") %>' DataSourceID="LotDescriptionDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator27" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="LotDescriptionTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Interior Features:</label><asp:CheckBoxList ID="InteriorFeaturesTextBox" runat="server" DataSourceID="InteriorDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("InteriorFeatures") %>' /><br />
       
       
       
        <label class="required">Master Bedroom Floor:</label><asp:DropDownList ID="MasterBedroomFloorTextBox" runat="server" SelectedValue='<%# Bind("MasterBedroomFloor") %>' DataSourceID="FloorDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator29" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="MasterBedroomFloorTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Master Bath:</label><asp:CheckBoxList ID="CheckBoxList5" runat="server" DataSourceID="MasterBathDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("MasterBath") %>' /><br />
       
       
       
        <label class="required">Cooling System:</label><asp:CheckBoxList ID="CheckBoxList6" runat="server" DataSourceID="CoolingDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("CoolingSystem") %>' /><br />
       
       
        <label class="required">Heating System:</label><asp:CheckBoxList ID="CheckBoxList7" runat="server" DataSourceID="HeatingDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("HeatingSystem") %>' /><br />
       
       
        <label>Number Of Ceiling Fans:</label><asp:TextBox ID="NumCeilingFansTextBox" runat="server" Text='<%# Bind("NumCeilingFans") %>' />
        <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="RangeValidator" ControlToValidate="NumCeilingFansTextBox" Text="*" MinimumValue="0" MaximumValue="15" SetFocusOnError="true" Type="Integer" /><br />
       
        <label class="required">Flooring:</label><asp:CheckBoxList ID="CheckBoxList8" runat="server" DataSourceID="FlooringDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("Flooring") %>' /><br />
       
        <label class="required">Appliances Equipment:</label><asp:CheckBoxList ID="CheckBoxList9" runat="server" DataSourceID="AppliancesDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("AppliancesEquipment") %>' /><br />
       
        <label>Dining Area Type:</label><asp:CheckBoxList ID="CheckBoxList10" runat="server" DataSourceID="DiningDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("DiningAreaType") %>' /><br />
       
       
        <label class="required">Type Of Roof:</label><asp:DropDownList ID="TypeOfRoofTextBox" runat="server" SelectedValue='<%# Bind("TypeOfRoof") %>' DataSourceID="RoofDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator35" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="TypeOfRoofTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Financial Terms Considered:</label><asp:CheckBoxList ID="CheckBoxList11" runat="server" DataSourceID="FinancialDataSource" DataTextField="Text" DataValueField="Text" SelectedValue='<%# Bind("FinancialTermsConsidered") %>' /><br />
   
        <label class="required">Source Of Water:</label><asp:DropDownList ID="SourceOfWaterTextBox" runat="server" SelectedValue='<%# Bind("SourceOfWater") %>' DataSourceID="WaterSourceDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator37" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="SourceOfWaterTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Sewage:</label><asp:DropDownList ID="SewageTextBox" runat="server" SelectedValue='<%# Bind("Sewage") %>' DataSourceID="SewageDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator38" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="SewageTextBox" SetFocusOnError="true" /><br />
       
        <label class="required">Electric:</label><asp:DropDownList ID="ElectricTextBox" runat="server" SelectedValue='<%# Bind("Electric") %>' DataSourceID="ElectricDataSource" DataTextField="Text" DataValueField="Text" />
        <asp:RequiredFieldValidator ID="RequiredFieldValidator39" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="ElectricTextBox" SetFocusOnError="true" /><br />
       
        <label>Sprinkler System:</label><asp:DropDownList ID="DropDownList32" runat="server" SelectedValue='<%# Bind("SprinklerSystem") %>' DataSourceID="YesNoDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Is Home Attached:</label><asp:DropDownList ID="DropDownList33" runat="server" SelectedValue='<%# Bind("IsHomeAttached") %>' DataSourceID="YesNoDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Home Occupancy:</label><asp:DropDownList ID="DropDownList34" runat="server" SelectedValue='<%# Bind("HomeOccupancy") %>'  DataSourceID="HomeOccupancyDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Entrance Level:</label><asp:DropDownList ID="DropDownList35" runat="server" SelectedValue='<%# Bind("EntranceLevel") %>' DataSourceID="FloorDataSource" DataTextField="Text" DataValueField="Text" /><br />
        <label>Remarks:</label><asp:TextBox ID="RemarksTextBox" runat="server" Text='<%# Bind("Remarks") %>' TextMode="MultiLine" /><br />
        <label>Directions:</label><asp:TextBox ID="DirectionsTextBox" runat="server" Text='<%# Bind("Directions") %>' TextMode="MultiLine" /><br />
       
        <label>&nbsp;</label><asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Add Property" />
    </InsertItemTemplate>
    </asp:FormView>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MLS4Less %>"
    DeleteCommand="sp_PropertiesDelete" DeleteCommandType="StoredProcedure" InsertCommand="sp_PropertiesInsert"
    InsertCommandType="StoredProcedure" SelectCommand="sp_PropertiesSelect" SelectCommandType="StoredProcedure"
    UpdateCommand="sp_PropertiesUpdate" UpdateCommandType="StoredProcedure" >
    <DeleteParameters>
        <asp:Parameter Name="PropertyId" Type="Int32" />
    </DeleteParameters>
       <SelectParameters>
        <asp:QueryStringParameter DefaultValue="0" Name="PropertyId" QueryStringField="PropertyId" Type="Int32" />
    </SelectParameters>
    <InsertParameters>
        <asp:CookieParameter Name="UserId" CookieName="UserId" Type="Int32" />
        <asp:Parameter Name="OwnersName" Type="String" />
        <asp:Parameter Name="Address" Type="String" />
        <asp:Parameter Name="Address2" Type="String" />
        <asp:Parameter Name="City" Type="String" />
        <asp:Parameter Name="Zip" Type="String" />
        <asp:Parameter Name="County" Type="String" />
        <asp:Parameter Name="State" Type="String" />
        <asp:Parameter Name="HomePhone" Type="String" />
        <asp:Parameter Name="PrefferedNumber" Type="String" />
        <asp:Parameter Name="EmailAddress" Type="String" />
        <asp:Parameter Name="AccountPassword" Type="String" />
        <asp:Parameter Name="ListPrice" Type="Decimal" />
        <asp:Parameter Name="TypeOfHome" Type="String" />
        <asp:Parameter Name="Bedrooms" Type="Int32" />
        <asp:Parameter Name="FullBaths" Type="Int32" />
        <asp:Parameter Name="HalfBaths" Type="Int32" />
        <asp:Parameter Name="YearBuilt" Type="Int32" />
        <asp:Parameter Name="LivingAreaUnderAir" Type="String" />
        <asp:Parameter Name="TotalArea" Type="String" />
        <asp:Parameter Name="LivingRoom" Type="String" />
        <asp:Parameter Name="DiningRoom" Type="String" />
        <asp:Parameter Name="DiningArea" Type="String" />
        <asp:Parameter Name="Kitchen" Type="String" />
        <asp:Parameter Name="FamilyRoom" Type="String" />
        <asp:Parameter Name="FloridaRoom" Type="String" />
        <asp:Parameter Name="MasterBedroom" Type="String" />
        <asp:Parameter Name="Bedroom2" Type="String" />
        <asp:Parameter Name="Bedroom3" Type="String" />
        <asp:Parameter Name="Bedroom4" Type="String" />
        <asp:Parameter Name="Bedroom5" Type="String" />
        <asp:Parameter Name="Den" Type="String" />
        <asp:Parameter Name="Porch" Type="String" />
        <asp:Parameter Name="UtilityLaundry" Type="String" />
        <asp:Parameter Name="PatioBalcony" Type="String" />
        <asp:Parameter Name="Garage" Type="String" />
        <asp:Parameter Name="GarageAttached" Type="String" />
        <asp:Parameter Name="Carport" Type="String" />
        <asp:Parameter Name="CarportAttached" Type="String" />
        <asp:Parameter Name="ParkingDescription" Type="String" />
        <asp:Parameter Name="ParkingRestrictions" Type="String" />
        <asp:Parameter Name="HomeownersAssoc" Type="String" />
        <asp:Parameter Name="MaintenenceFee" Type="String" />
        <asp:Parameter Name="MaintenencePaid" Type="String" />
        <asp:Parameter Name="MaintenanceIncludes" Type="String" />
        <asp:Parameter Name="CommunityRestrictions" Type="String" />
        <asp:Parameter Name="PetsAllowed" Type="String" />
        <asp:Parameter Name="PetRestrictions" Type="String" />
        <asp:Parameter Name="SubdivisionAmenities" Type="String" />
        <asp:Parameter Name="SpecialAssesments" Type="String" />
        <asp:Parameter Name="WaterfrontProperty" Type="String" />
        <asp:Parameter Name="WaterfrontDescription" Type="String" />
        <asp:Parameter Name="OceanAccess" Type="String" />
        <asp:Parameter Name="DockageType" Type="String" />
        <asp:Parameter Name="DirectionHomeFaces" Type="String" />
        <asp:Parameter Name="PrivatePool" Type="String" />
        <asp:Parameter Name="TypeOfPool" Type="String" />
        <asp:Parameter Name="DesignOfHome" Type="String" />
        <asp:Parameter Name="ConstructionOfHome" Type="String" />
        <asp:Parameter Name="LotDescription" Type="String" />
        <asp:Parameter Name="InteriorFeatures" Type="String" />
        <asp:Parameter Name="MasterBedroomFloor" Type="String" />
        <asp:Parameter Name="MasterBath" Type="String" />
        <asp:Parameter Name="CoolingSystem" Type="String" />
        <asp:Parameter Name="HeatingSystem" Type="String" />
        <asp:Parameter Name="NumCeilingFans" Type="Int32" />
        <asp:Parameter Name="Flooring" Type="String" />
        <asp:Parameter Name="AppliancesEquipment" Type="String" />
        <asp:Parameter Name="DiningAreaType" Type="String" />
        <asp:Parameter Name="TypeOfRoof" Type="String" />
        <asp:Parameter Name="FinancialTermsConsidered" Type="String" />
        <asp:Parameter Name="SourceOfWater" Type="String" />
        <asp:Parameter Name="Sewage" Type="String" />
        <asp:Parameter Name="Electric" Type="String" />
        <asp:Parameter Name="SprinklerSystem" Type="String" />
        <asp:Parameter Name="IsHomeAttached" Type="String" />
        <asp:Parameter Name="HomeOccupancy" Type="String" />
        <asp:Parameter Name="EntranceLevel" Type="String" />
        <asp:Parameter Name="Remarks" Type="String" />
        <asp:Parameter Name="Directions" Type="String" />
       <asp:Parameter Name="PID"  Type="Int16" Direction="InputOutput" />
    </InsertParameters>
0
 
LVL 7

Expert Comment

by:kGenius
ID: 16959438
> (I removed the ItemTemplate, UpdateTemplate becuase the source was so long):
Almost hilarous :-)

what I don't understand: how do you insert your data in SQL: you use stored procedure, but when you want to insert multiple values for one field, how is it stored then?
Do have code-behind in your app that reads the several checked values of your checkboxlist and insert them then in your database?

Can you post the stored procedure for inserting in database?
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 2

Author Comment

by:alivemedia
ID: 16959560
Man you guys are brutal, I thought simplifying my post would make things easier, not open me up for abuse :P

Here's my SP (I didn;t remove any code form this one ;):

ALTER PROCEDURE [flat].[sp_PropertiesInsert]
      @UserId int,
      @OwnersName varchar(50),
      @Address varchar(50),
      @Address2 varchar(50),
      @City varchar(50),
      @Zip varchar(50),
      @County varchar(50),
      @State varchar(50),
      @HomePhone varchar(50),
      @PrefferedNumber varchar(50),
      @EmailAddress varchar(50),
      @AccountPassword varchar(50),
      @ListPrice money,
      @TypeOfHome varchar(25),
      @Bedrooms int,
      @FullBaths int,
      @HalfBaths int,
      @YearBuilt int,
      @LivingAreaUnderAir varchar(25),
      @TotalArea varchar(25),
      @LivingRoom varchar(25),
      @DiningRoom varchar(25),
      @DiningArea varchar(25),
      @Kitchen varchar(25),
      @FamilyRoom varchar(25),
      @FloridaRoom varchar(25),
      @MasterBedroom varchar(25),
      @Bedroom2 varchar(25),
      @Bedroom3 varchar(25),
      @Bedroom4 varchar(25),
      @Bedroom5 varchar(25),
      @Den varchar(25),
      @Porch varchar(25),
      @UtilityLaundry varchar(25),
      @PatioBalcony varchar(25),
      @Garage varchar(15),
      @GarageAttached varchar(4),
      @Carport varchar(15),
      @CarportAttached varchar(4),
      @ParkingDescription varchar(25),
      @ParkingRestrictions varchar(25),
      @HomeownersAssoc varchar(4),
      @MaintenenceFee varchar(25),
      @MaintenencePaid varchar(25),
      @MaintenanceIncludes ntext,
      @CommunityRestrictions ntext,
      @PetsAllowed varchar(4),
      @PetRestrictions ntext,
      @SubdivisionAmenities ntext,
      @SpecialAssesments varchar(4),
      @WaterfrontProperty varchar(4),
      @WaterfrontDescription varchar(25),
      @OceanAccess varchar(4),
      @DockageType varchar(25),
      @DirectionHomeFaces varchar(25),
      @PrivatePool varchar(4),
      @TypeOfPool varchar(25),
      @DesignOfHome varchar(25),
      @ConstructionOfHome varchar(25),
      @LotDescription varchar(25),
      @InteriorFeatures ntext,
      @MasterBedroomFloor varchar(25),
      @MasterBath ntext,
      @CoolingSystem ntext,
      @HeatingSystem ntext,
      @NumCeilingFans int,
      @Flooring ntext,
      @AppliancesEquipment ntext,
      @DiningAreaType ntext,
      @TypeOfRoof varchar(25),
      @FinancialTermsConsidered ntext,
      @SourceOfWater varchar(25),
      @Sewage varchar(25),
      @Electric varchar(25),
      @SprinklerSystem varchar(4),
      @IsHomeAttached varchar(4),
      @HomeOccupancy varchar(25),
      @EntranceLevel varchar(25),
      @Remarks ntext,
      @Directions ntext,
      @PID int OUTPUT
AS

INSERT INTO Properties (
      UserId,
      OwnersName,
      Address,
      Address2,
      City,
      Zip,
      County,
      State,
      HomePhone,
      PrefferedNumber,
      EmailAddress,
      AccountPassword,
      ListPrice,
      TypeOfHome,
      Bedrooms,
      FullBaths,
      HalfBaths,
      YearBuilt,
      LivingAreaUnderAir,
      TotalArea,
      LivingRoom,
      DiningRoom,
      DiningArea,
      Kitchen,
      FamilyRoom,
      FloridaRoom,
      MasterBedroom,
      Bedroom2,
      Bedroom3,
      Bedroom4,
      Bedroom5,
      Den,
      Porch,
      UtilityLaundry,
      PatioBalcony,
      Garage,
      GarageAttached,
      Carport,
      CarportAttached,
      ParkingDescription,
      ParkingRestrictions,
      HomeownersAssoc,
      MaintenenceFee,
      MaintenencePaid,
      MaintenanceIncludes,
      CommunityRestrictions,
      PetsAllowed,
      PetRestrictions,
      SubdivisionAmenities,
      SpecialAssesments,
      WaterfrontProperty,
      WaterfrontDescription,
      OceanAccess,
      DockageType,
      DirectionHomeFaces,
      PrivatePool,
      TypeOfPool,
      DesignOfHome,
      ConstructionOfHome,
      LotDescription,
      InteriorFeatures,
      MasterBedroomFloor,
      MasterBath,
      CoolingSystem,
      HeatingSystem,
      NumCeilingFans,
      Flooring,
      AppliancesEquipment,
      DiningAreaType,
      TypeOfRoof,
      FinancialTermsConsidered,
      SourceOfWater,
      Sewage,
      Electric,
      SprinklerSystem,
      IsHomeAttached,
      HomeOccupancy,
      EntranceLevel,
      Remarks,
      Directions)
VALUES (
      @UserId,
      @OwnersName,
      @Address,
      @Address2,
      @City,
      @Zip,
      @County,
      @State,
      @HomePhone,
      @PrefferedNumber,
      @EmailAddress,
      @AccountPassword,
      @ListPrice,
      @TypeOfHome,
      @Bedrooms,
      @FullBaths,
      @HalfBaths,
      @YearBuilt,
      @LivingAreaUnderAir,
      @TotalArea,
      @LivingRoom,
      @DiningRoom,
      @DiningArea,
      @Kitchen,
      @FamilyRoom,
      @FloridaRoom,
      @MasterBedroom,
      @Bedroom2,
      @Bedroom3,
      @Bedroom4,
      @Bedroom5,
      @Den,
      @Porch,
      @UtilityLaundry,
      @PatioBalcony,
      @Garage,
      @GarageAttached,
      @Carport,
      @CarportAttached,
      @ParkingDescription,
      @ParkingRestrictions,
      @HomeownersAssoc,
      @MaintenenceFee,
      @MaintenencePaid,
      @MaintenanceIncludes,
      @CommunityRestrictions,
      @PetsAllowed,
      @PetRestrictions,
      @SubdivisionAmenities,
      @SpecialAssesments,
      @WaterfrontProperty,
      @WaterfrontDescription,
      @OceanAccess,
      @DockageType,
      @DirectionHomeFaces,
      @PrivatePool,
      @TypeOfPool,
      @DesignOfHome,
      @ConstructionOfHome,
      @LotDescription,
      @InteriorFeatures,
      @MasterBedroomFloor,
      @MasterBath,
      @CoolingSystem,
      @HeatingSystem,
      @NumCeilingFans,
      @Flooring,
      @AppliancesEquipment,
      @DiningAreaType,
      @TypeOfRoof,
      @FinancialTermsConsidered,
      @SourceOfWater,
      @Sewage,
      @Electric,
      @SprinklerSystem,
      @IsHomeAttached,
      @HomeOccupancy,
      @EntranceLevel,
      @Remarks,
      @Directions)

SELECT @PID = Scope_Identity()
0
 
LVL 7

Accepted Solution

by:
kGenius earned 500 total points
ID: 16963634
nothing brutal about it. But be serious, it is funny -- when you expect a code "less long" and then you see a huge code...

Do you have code to fill the checkboxlist?
maybe this tutorial can help: http://aspnet.4guysfromrolla.com/articles/050703-1.aspx

and again: my excuses for my brutalness (? correct English ?)

Good luck
kGenius
0
 
LVL 2

Author Comment

by:alivemedia
ID: 16963638
In case anyone cares, I got it figured out:

For inserting I used:

Protected Sub SqlDataSource1_Inserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Inserted

 Dim conn As New SqlConnection(connStr)
Dim UpdateString As String = "UPDATE Properties SET  MaintenanceIncludes='" & GetValues("MaintenanceIncludes") & "', CommunityRestrictions='" & GetValues("CommunityRestrictions") & "', SubdivisionAmenities='" & GetValues("SubdivisionAmenities") & "', InteriorFeatures='" & GetValues("InteriorFeatures") & "', MasterBath='" & GetValues("MasterBath") & "', CoolingSystem='" & GetValues("CoolingSystem") & "', HeatingSystem='" & GetValues("HeatingSystem") & "', Flooring='" & GetValues("Flooring") & "', AppliancesEquipment='" & GetValues("AppliancesEquipment") & "', DiningAreaType='" & GetValues("DiningAreaType") & "', FinancialTermsConsidered='" & GetValues("FinancialTermsConsidered") & "' WHERE PropertyId=" & e.Command.Parameters("@PID").Value.ToString()
         
Dim updateCmd As New SqlCommand(UpdateString, conn)
updateCmd.ExecuteScalar()  

  Catch ex As Exception
            Response.Write("<p>" & ex.Message)
        End Try

End Sub


Public Function GetValues(ByVal ControlName As String)

        Dim ListControl As CheckBoxList = CType(FormView1.FindControl(ControlName), CheckBoxList)
        Dim li As ListItem
        Dim Values As String
        For Each li In ListControl.Items
            If li.Selected = True Then
                Values = Values & li.Text & ", "
            End If
        Next

        If IsNothing(Values) Then Values = " , "

        Return Left(Values, Values.Length - 2)

    End Function
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

785 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