Bind a dropdownlist UserControl with C#

I have a User Control with a State/County Dropdown list, I'm not sure How I would bind it to the Database using C#. Here is the usercontrol Code and the code behind page below.

<%@ Control Language="C#" ClassName="DynDropDown" AutoEventWireup="true" CodeFile="CountyDDLControl.ascx.cs" Inherits="DisplayCountyDDL" %>
State:
<asp:DropDownList runat="server" id="ddlState" AutoPostBack="True" DataSourceID="StateDS" DataTextField="State" DataValueField="State">
</asp:DropDownList>
<asp:SqlDataSource ID="StateDS" runat="server"
    ConnectionString="<%$ ConnectionStrings:Prop_ChangeConnectionString %>"
    SelectCommand="SELECT [State] FROM [PC_State]">
</asp:SqlDataSource>
<br/>
<br/>
County:
<asp:DropDownList id="ddlCounty" runat="server" DataSourceID="CountyDS" DataTextField="County" DataValueField="County">
</asp:DropDownList>
<asp:SqlDataSource ID="CountyDS" runat="server"
    ConnectionString="<%$ ConnectionStrings:Prop_ChangeConnectionString %>"
    SelectCommand="SELECT [County] FROM [PC_Counties] WHERE ([State] = @State)">
      <SelectParameters>
            <asp:controlparameter ControlID="ddlState" Name="State" PropertyName="SelectedValue" Type="String" />
      </SelectParameters>
</asp:SqlDataSource>

using System;
using System.IO;
using System.Data;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web.Services.Protocols;
 
public partial class _Default : System.Web.UI.Page
{
 
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("Data Source=(local);Initial Catalog=Prop_Change;Integrated Security=SSPI");
        SqlCommand com = new SqlCommand("Insert into PropChanges_AQMain(Co_Name, Office, Sub_Date, Proj_Name,Tax_Dist,Inf_Other, Rec_Date, Rec_VolBook,Rec_Page,Rec_InstNo,Rec_AgNo,Rec_AdAgNo,ASFS_FRACT_N,ASFS_FRACT_D,ASFS_GROSSAC,ASFS_NETAC,ASFS_OVERLAP,ASFS_TAXPARCELID,ASSurf_FRACT_N,ASSurf_FRACT_D,ASSurf_GROSSAC,ASSurf_NETAC,ASSurf_OVERLAP,ASSurf_TAXPARCELID,ASCoal_FRACT_N,ASCoal_FRACT_D,ASCoal_GROSSAC,ASCoal_NETAC,ASCoal_OVERLAP,ASCoal_TAXPARCELID,ASOG_FRACT_N,ASOG_FRACT_D,ASOG_GROSSAC,ASOG_NETAC,ASOG_OVERLAP,ASOG_TAXPARCELID,ASMR_FRACT_N,ASMR_FRACT_D,ASMR_GROSSAC,ASMR_NETAC,ASMR_OVERLAP,ASMR_TAXPARCELID,ASCM_FRACT_N,ASCM_FRACT_D,ASCM_GROSSAC,ASCM_NETAC,ASCM_OVERLAP,ASCM_TAXPARCELID,ASOther_FRACT_N,ASOther_FRACT_D,ASOther_GROSSAC,ASOther_NETAC,ASOther_OVERLAP,ASOther_TAXPARCELID,AdInformation,EN_OrigDocumentIMG,EN_OrigDocumentIMG_DESC,EN_ClosingSettIMG,EN_ClosingSettIMG_DESC,EN_RecordedMemIMG,EN_RecordedMemIMG_DESC,EN_OccRentIMG,EN_OccRentIMG_DESC,EN_AcqDispApprIMG,EN_AcqDispApprIMG_DESC,EN_DiscStateIMG,EN_DiscStateIMG_DESC,EN_NonForeignAffIMG,EN_NonForeignAffIMG_DESC,EN_OwnersAffIMG,EN_OwnersAffIMG_DESC,EN_1009SIMG,EN_1009SIMG_DESC,EN_PaintDiscIMG,EN_PaintDiscIMG_DESC,EN_TitleOpinIMG,EN_TitleOpinIMG_DESC,EN_PhotosIMG,EN_PhotosIMG_DESC,EN_ApprIMG,EN_ApprIMG_DESC,EN_MapIMG,EN_MapIMG_DESC,EN_AdditionalIMG,EN_AdditionalIMG_DESC,EN_DocFowLaterIMG,EN_DocFowLaterIMG_DESC,Prep_By) values(@Co_Name, @Office, @Sub_Date, @Proj_Name,@Tax_Dist,@Inf_Other, @Rec_Date, @Rec_VolBook,@Rec_Page,@Rec_InstNo,@Rec_AgNo,@Rec_AdAgNo,@ASFS_FRACT_N,@ASFS_FRACT_D,@ASFS_GROSSAC,@ASFS_NETAC,@ASFS_OVERLAP,@ASFS_TAXPARCELID,@ASSurf_FRACT_N,@ASSurf_FRACT_D,@ASSurf_GROSSAC,@ASSurf_NETAC,@ASSurf_OVERLAP,@ASSurf_TAXPARCELID,@ASCoal_FRACT_N,@ASCoal_FRACT_D,@ASCoal_GROSSAC,@ASCoal_NETAC,@ASCoal_OVERLAP,@ASCoal_TAXPARCELID,@ASOG_FRACT_N,@ASOG_FRACT_D,@ASOG_GROSSAC,@ASOG_NETAC,@ASOG_OVERLAP,@ASOG_TAXPARCELID,@ASMR_FRACT_N,@ASMR_FRACT_D,@ASMR_GROSSAC,@ASMR_NETAC,@ASMR_OVERLAP,@ASMR_TAXPARCELID,@ASCM_FRACT_N,@ASCM_FRACT_D,@ASCM_GROSSAC,@ASCM_NETAC,@ASCM_OVERLAP,@ASCM_TAXPARCELID,@ASOther_FRACT_N,@ASOther_FRACT_D,@ASOther_GROSSAC,@ASOther_NETAC,@ASOther_OVERLAP,@ASOther_TAXPARCELID,@AdInformation,@EN_OrigDocumentIMG,@EN_OrigDocumentIMG_DESC,@EN_ClosingSettIMG,@EN_ClosingSettIMG_DESC,@EN_RecordedMemIMG,@EN_RecordedMemIMG_DESC,@EN_OccRentIMG,@EN_OccRentIMG_DESC,@EN_AcqDispApprIMG,@EN_AcqDispApprIMG_DESC,@EN_DiscStateIMG,@EN_DiscStateIMG_DESC,@EN_NonForeignAffIMG,@EN_NonForeignAffIMG_DESC,@EN_OwnersAffIMG,@EN_OwnersAffIMG_DESC,@EN_1009SIMG,@EN_1009SIMG_DESC,@EN_PaintDiscIMG,@EN_PaintDiscIMG_DESC,@EN_TitleOpinIMG,@EN_TitleOpinIMG_DESC,@EN_PhotosIMG,@EN_PhotosIMG_DESC,@EN_ApprIMG,@EN_ApprIMG_DESC,@EN_MapIMG,@EN_MapIMG_DESC,@EN_AdditionalIMG,@EN_AdditionalIMG_DESC,@EN_DocFowLaterIMG,@EN_DocFowLaterIMG_DESC,@Prep_By)", con);
        string strPath = string.Empty;
        int intResult = 0;
        con.Open();
 
        TextBox CompanyTB = (TextBox)FormView1.FindControl("Co_NameTextBox");
        string txtBox = CompanyTB.Text.Trim();
        com.Parameters.Add("@Co_Name", SqlDbType.NVarChar, 50, "Co_Name").Value = Server.HtmlEncode(txtBox);
 
        TextBox OfficeTB = (TextBox)FormView1.FindControl("OfficeTextBox");
        string txtBox2 = OfficeTB.Text.Trim();
        com.Parameters.Add("@Office", SqlDbType.NVarChar, 50, "Office").Value = Server.HtmlEncode(txtBox2);
 
        TextBox SubDateTB = (TextBox)FormView1.FindControl("Sub_DateTextBox");
        string txtBox3 = SubDateTB.Text.Trim();
        com.Parameters.Add("@Sub_Date", SqlDbType.DateTime, 50, "Sub_Date").Value = Server.HtmlEncode(txtBox3);
 
        TextBox ProjNameTB = (TextBox)FormView1.FindControl("Proj_NameTextBox");
        string txtBox4 = ProjNameTB.Text.Trim();
        com.Parameters.Add("@Proj_Name", SqlDbType.NVarChar, 50, "Proj_Name").Value = Server.HtmlEncode(txtBox4);
 
        TextBox TaxDistTB = (TextBox)FormView1.FindControl("Tax_DistTextBox");
        string txtBox7 = TaxDistTB.Text.Trim();
        com.Parameters.Add("@Tax_Dist", SqlDbType.NVarChar, 50, "Tax_Dist").Value = Server.HtmlEncode(txtBox7);
 
        TextBox InfOtherTB = (TextBox)FormView1.FindControl("Inf_OtherTextBox");
        string txtBox8 = InfOtherTB.Text.Trim();
        com.Parameters.Add("@Inf_Other", SqlDbType.NVarChar, 50, "Inf_Other").Value = Server.HtmlEncode(txtBox8);
 
        TextBox RecDateTB = (TextBox)FormView1.FindControl("Rec_DateTextBox");
        string txtBox9 = RecDateTB.Text.Trim();
        com.Parameters.Add("@Rec_Date", SqlDbType.DateTime, 50, "Rec_Date").Value = Server.HtmlEncode(txtBox9);
 
        TextBox RecVolBookTB = (TextBox)FormView1.FindControl("Rec_VolBookTextBox");
        string txtBox10 = RecVolBookTB.Text.Trim();
        com.Parameters.Add("@Rec_VolBook", SqlDbType.NVarChar, 50, "Rec_VolBook").Value = Server.HtmlEncode(txtBox10);
 
        TextBox RecPageTB = (TextBox)FormView1.FindControl("Rec_PageTextBox");
        string txtBox11 = RecPageTB.Text.Trim();
        com.Parameters.Add("@Rec_Page", SqlDbType.NVarChar, 50, "Rec_Page").Value = Server.HtmlEncode(txtBox11);
 
        TextBox RecInstNoTB = (TextBox)FormView1.FindControl("Rec_InstNoTextBox");
        string txtBox12 = RecInstNoTB.Text.Trim();
        com.Parameters.Add("@Rec_InstNo", SqlDbType.NVarChar, 50, "Rec_InstNo").Value = Server.HtmlEncode(txtBox12);
 
        TextBox RecAgNoTB = (TextBox)FormView1.FindControl("Rec_AgNoTextBox");
        string txtBox13 = RecAgNoTB.Text.Trim();
        com.Parameters.Add("@Rec_AgNo", SqlDbType.NVarChar, 50, "Rec_AgNo").Value = Server.HtmlEncode(txtBox13);
 
        TextBox RecAdAgNoTB = (TextBox)FormView1.FindControl("Rec_AdAgNoTextBox");
        string txtBox14 = RecAdAgNoTB.Text.Trim();
        com.Parameters.Add("@Rec_AdAgNo", SqlDbType.NVarChar, 50, "Rec_AdAgNo").Value = Server.HtmlEncode(txtBox14);
 
        TextBox ASFSFRACTNTB = (TextBox)FormView1.FindControl("ASFS_FRACT_NTB");
        string txtBox15 = ASFSFRACTNTB.Text.Trim();
        com.Parameters.Add("@ASFS_FRACT_N", SqlDbType.NChar, 10, "ASFS_FRACT_N").Value = Server.HtmlEncode(txtBox15);
 
        TextBox ASFSFRACTDTB = (TextBox)FormView1.FindControl("ASFS_FRACT_DTB");
        string txtBox16 = ASFSFRACTDTB.Text.Trim();
        com.Parameters.Add("@ASFS_FRACT_D", SqlDbType.NChar, 10, "ASFS_FRACT_D").Value = Server.HtmlEncode(txtBox16);
 
        TextBox ASFSGROSSACTB = (TextBox)FormView1.FindControl("ASFS_GROSSACTB");
        string txtBox17 = ASFSGROSSACTB.Text.Trim();
        com.Parameters.Add("@ASFS_GROSSAC", SqlDbType.NChar, 10, "ASFS_GROSSAC").Value = Server.HtmlEncode(txtBox17);
 
        TextBox ASFSNETACTB = (TextBox)FormView1.FindControl("ASFS_NETACTB");
        string txtBox18 = ASFSNETACTB.Text.Trim();
        com.Parameters.Add("@ASFS_NETAC", SqlDbType.NChar, 10, "ASFS_NETAC").Value = Server.HtmlEncode(txtBox18);
 
        TextBox ASFSOVERLAPTB = (TextBox)FormView1.FindControl("ASFS_OVERLAPTB");
        string txtBox19 = ASFSOVERLAPTB.Text.Trim();
        com.Parameters.Add("@ASFS_OVERLAP", SqlDbType.NChar, 10, "ASFS_OVERLAP").Value = Server.HtmlEncode(txtBox19);
 
        TextBox ASFSTAXPARCELIDTB = (TextBox)FormView1.FindControl("ASFS_TAXPARCELIDTB");
        string txtBox20 = ASFSTAXPARCELIDTB.Text.Trim();
        com.Parameters.Add("@ASFS_TAXPARCELID", SqlDbType.NChar, 10, "ASFS_TAXPARCELID").Value = Server.HtmlEncode(txtBox20);
 
        TextBox ASSurfFRACTNTB = (TextBox)FormView1.FindControl("ASSurf_FRACT_NTB");
        string txtBox21 = ASSurfFRACTNTB.Text.Trim();
        com.Parameters.Add("@ASSurf_FRACT_N", SqlDbType.NChar, 10, "ASSurf_FRACT_N").Value = Server.HtmlEncode(txtBox21);
 
        TextBox ASSurfFRACTDTB = (TextBox)FormView1.FindControl("ASSurf_FRACT_DTB");
        string txtBox22 = ASSurfFRACTDTB.Text.Trim();
        com.Parameters.Add("@ASSurf_FRACT_D", SqlDbType.NChar, 10, "ASSurf_FRACT_D").Value = Server.HtmlEncode(txtBox22);
 
        TextBox ASSurfGROSSACTB = (TextBox)FormView1.FindControl("ASSurf_GROSSACTB");
        string txtBox23 = ASSurfGROSSACTB.Text.Trim();
        com.Parameters.Add("@ASSurf_GROSSAC", SqlDbType.NChar, 10, "ASSurf_GROSSAC").Value = Server.HtmlEncode(txtBox23);
 
        TextBox ASSurfNETACTB = (TextBox)FormView1.FindControl("ASSurf_NETACTB");
        string txtBox24 = ASSurfNETACTB.Text.Trim();
        com.Parameters.Add("@ASSurf_NETAC", SqlDbType.NChar, 10, "ASSurf_NETAC").Value = Server.HtmlEncode(txtBox24);
 
        TextBox ASSurfOVERLAPTB = (TextBox)FormView1.FindControl("ASSurf_OVERLAPTB");
        string txtBox25 = ASSurfOVERLAPTB.Text.Trim();
        com.Parameters.Add("@ASSurf_OVERLAP", SqlDbType.NChar, 10, "ASSurf_OVERLAP").Value = Server.HtmlEncode(txtBox25);
 
        TextBox ASSurfTAXPARCELIDTB = (TextBox)FormView1.FindControl("ASSurf_TAXPARCELIDTB");
        string txtBox26 = ASSurfTAXPARCELIDTB.Text.Trim();
        com.Parameters.Add("@ASSurf_TAXPARCELID", SqlDbType.NChar, 10, "ASSurf_TAXPARCELID").Value = Server.HtmlEncode(txtBox26);
 
        TextBox ASCoalFRACTNTB = (TextBox)FormView1.FindControl("ASCoal_FRACT_NTB");
        string txtBox27 = ASCoalFRACTNTB.Text.Trim();
        com.Parameters.Add("@ASCoal_FRACT_N", SqlDbType.NChar, 10, "ASCoal_FRACT_N").Value = Server.HtmlEncode(txtBox27);
 
        TextBox ASCoalFRACTDTB = (TextBox)FormView1.FindControl("ASCoal_FRACT_DTB");
        string txtBox28 = ASCoalFRACTDTB.Text.Trim();
        com.Parameters.Add("@ASCoal_FRACT_D", SqlDbType.NChar, 10, "ASCoal_FRACT_D").Value = Server.HtmlEncode(txtBox28);
 
        TextBox ASCoalGROSSACTB = (TextBox)FormView1.FindControl("ASCoal_GROSSACTB");
        string txtBox29 = ASCoalGROSSACTB.Text.Trim();
        com.Parameters.Add("@ASCoal_GROSSAC", SqlDbType.NChar, 10, "ASCoal_GROSSAC").Value = Server.HtmlEncode(txtBox29);
 
        TextBox ASCoalNETACTB = (TextBox)FormView1.FindControl("ASCoal_NETACTB");
        string txtBox30 = ASCoalNETACTB.Text.Trim();
        com.Parameters.Add("@ASCoal_NETAC", SqlDbType.NChar, 10, "ASCoal_NETAC").Value = Server.HtmlEncode(txtBox30);
 
        TextBox ASCoalOVERLAPTB = (TextBox)FormView1.FindControl("ASCoal_OVERLAPTB");
        string txtBox31 = ASCoalOVERLAPTB.Text.Trim();
        com.Parameters.Add("@ASCoal_OVERLAP", SqlDbType.NChar, 10, "ASCoal_OVERLAP").Value = Server.HtmlEncode(txtBox31);
 
        TextBox ASCoalTAXPARCELIDTB = (TextBox)FormView1.FindControl("ASCoal_TAXPARCELIDTB");
        string txtBox32 = ASCoalTAXPARCELIDTB.Text.Trim();
        com.Parameters.Add("@ASCoal_TAXPARCELID", SqlDbType.NChar, 10, "ASCoal_TAXPARCELID").Value = Server.HtmlEncode(txtBox32);
 
        TextBox ASOGFRACTNTB = (TextBox)FormView1.FindControl("ASOG_FRACT_NTB");
        string txtBox33 = ASOGFRACTNTB.Text.Trim();
        com.Parameters.Add("@ASOG_FRACT_N", SqlDbType.NChar, 10, "ASOG_FRACT_N").Value = Server.HtmlEncode(txtBox33);
 
        TextBox ASOGFRACTDTB = (TextBox)FormView1.FindControl("ASOG_FRACT_DTB");
        string txtBox34 = ASOGFRACTDTB.Text.Trim();
        com.Parameters.Add("@ASOG_FRACT_D", SqlDbType.NChar, 10, "ASOG_FRACT_D").Value = Server.HtmlEncode(txtBox34);
 
        TextBox ASOGGROSSACTB = (TextBox)FormView1.FindControl("ASOG_GROSSACTB");
        string txtBox35 = ASOGGROSSACTB.Text.Trim();
        com.Parameters.Add("@ASOG_GROSSAC", SqlDbType.NChar, 10, "ASOG_GROSSAC").Value = Server.HtmlEncode(txtBox35);
 
        TextBox ASOGNETACTB = (TextBox)FormView1.FindControl("ASOG_NETACTB");
        string txtBox36 = ASOGNETACTB.Text.Trim();
        com.Parameters.Add("@ASOG_NETAC", SqlDbType.NChar, 10, "ASOG_NETAC").Value = Server.HtmlEncode(txtBox36);
 
        TextBox ASOGOVERLAPTB = (TextBox)FormView1.FindControl("ASOG_OVERLAPTB");
        string txtBox37 = ASOGOVERLAPTB.Text.Trim();
        com.Parameters.Add("@ASOG_OVERLAP", SqlDbType.NChar, 10, "ASOG_OVERLAP").Value = Server.HtmlEncode(txtBox37);
 
        TextBox ASOGTAXPARCELIDTB = (TextBox)FormView1.FindControl("ASOG_TAXPARCELIDTB");
        string txtBox38 = ASOGTAXPARCELIDTB.Text.Trim();
        com.Parameters.Add("@ASOG_TAXPARCELID", SqlDbType.NChar, 10, "ASOG_TAXPARCELID").Value = Server.HtmlEncode(txtBox38);
 
        TextBox ASMRFRACTNTB = (TextBox)FormView1.FindControl("ASMR_FRACT_NTB");
        string txtBox39 = ASMRFRACTNTB.Text.Trim();
        com.Parameters.Add("@ASMR_FRACT_N", SqlDbType.NChar, 10, "ASMR_FRACT_N").Value = Server.HtmlEncode(txtBox39);
 
        TextBox ASMRFRACTDTB = (TextBox)FormView1.FindControl("ASMR_FRACT_DTB");
        string txtBox40 = ASMRFRACTDTB.Text.Trim();
        com.Parameters.Add("@ASMR_FRACT_D", SqlDbType.NChar, 10, "ASMR_FRACT_D").Value = Server.HtmlEncode(txtBox40);
 
        TextBox ASMRGROSSACTB = (TextBox)FormView1.FindControl("ASMR_GROSSACTB");
        string txtBox41 = ASMRGROSSACTB.Text.Trim();
        com.Parameters.Add("@ASMR_GROSSAC", SqlDbType.NChar, 10, "ASMR_GROSSAC").Value = Server.HtmlEncode(txtBox41);
 
        TextBox ASMRNETACTB = (TextBox)FormView1.FindControl("ASMR_NETACTB");
        string txtBox42 = ASMRNETACTB.Text.Trim();
        com.Parameters.Add("@ASMR_NETAC", SqlDbType.NChar, 10, "ASMR_NETAC").Value = Server.HtmlEncode(txtBox42);
 
        TextBox ASMROVERLAPTB = (TextBox)FormView1.FindControl("ASMR_OVERLAPTB");
        string txtBox43 = ASMROVERLAPTB.Text.Trim();
        com.Parameters.Add("@ASMR_OVERLAP", SqlDbType.NChar, 10, "ASMR_OVERLAP").Value = Server.HtmlEncode(txtBox43);
 
        TextBox ASMRTAXPARCELIDTB = (TextBox)FormView1.FindControl("ASMR_TAXPARCELIDTB");
        string txtBox44 = ASMRTAXPARCELIDTB.Text.Trim();
        com.Parameters.Add("@ASMR_TAXPARCELID", SqlDbType.NChar, 10, "ASMR_TAXPARCELID").Value = Server.HtmlEncode(txtBox44);
 
        TextBox ASCMFRACTNTB = (TextBox)FormView1.FindControl("ASCM_FRACT_NTB");
        string txtBox45 = ASCMFRACTNTB.Text.Trim();
        com.Parameters.Add("@ASCM_FRACT_N", SqlDbType.NChar, 10, "ASCM_FRACT_N").Value = Server.HtmlEncode(txtBox45);
 
        TextBox ASCMFRACTDTB = (TextBox)FormView1.FindControl("ASCM_FRACT_DTB");
        string txtBox46 = ASCMFRACTDTB.Text.Trim();
        com.Parameters.Add("@ASCM_FRACT_D", SqlDbType.NChar, 10, "ASCM_FRACT_D").Value = Server.HtmlEncode(txtBox46);
 
        TextBox ASCMGROSSACTB = (TextBox)FormView1.FindControl("ASCM_GROSSACTB");
        string txtBox47 = ASCMGROSSACTB.Text.Trim();
        com.Parameters.Add("@ASCM_GROSSAC", SqlDbType.NChar, 10, "ASCM_GROSSAC").Value = Server.HtmlEncode(txtBox47);
 
        TextBox ASCMNETACTB = (TextBox)FormView1.FindControl("ASCM_NETACTB");
        string txtBox48 = ASCMNETACTB.Text.Trim();
        com.Parameters.Add("@ASCM_NETAC", SqlDbType.NChar, 10, "ASCM_NETAC").Value = Server.HtmlEncode(txtBox48);
 
        TextBox ASCMOVERLAPTB = (TextBox)FormView1.FindControl("ASCM_OVERLAPTB");
        string txtBox49 = ASCMOVERLAPTB.Text.Trim();
        com.Parameters.Add("@ASCM_OVERLAP", SqlDbType.NChar, 10, "ASCM_OVERLAP").Value = Server.HtmlEncode(txtBox49);
 
        TextBox ASCMTAXPARCELIDTB = (TextBox)FormView1.FindControl("ASCM_TAXPARCELIDTB");
        string txtBox50 = ASCMTAXPARCELIDTB.Text.Trim();
        com.Parameters.Add("@ASCM_TAXPARCELID", SqlDbType.NChar, 10, "ASCM_TAXPARCELID").Value = Server.HtmlEncode(txtBox50);
 
        TextBox ASOtherFRACTNTB = (TextBox)FormView1.FindControl("ASOther_FRACT_NTB");
        string txtBox51 = ASOtherFRACTNTB.Text.Trim();
        com.Parameters.Add("@ASOther_FRACT_N", SqlDbType.NChar, 10, "ASOther_FRACT_N").Value = Server.HtmlEncode(txtBox51);
 
        TextBox ASOtherFRACTDTB = (TextBox)FormView1.FindControl("ASOther_FRACT_DTB");
        string txtBox52 = ASOtherFRACTDTB.Text.Trim();
        com.Parameters.Add("@ASOther_FRACT_D", SqlDbType.NChar, 10, "ASOther_FRACT_D").Value = Server.HtmlEncode(txtBox52);
 
        TextBox ASOtherGROSSACTB = (TextBox)FormView1.FindControl("ASOther_GROSSACTB");
        string txtBox53 = ASOtherGROSSACTB.Text.Trim();
        com.Parameters.Add("@ASOther_GROSSAC", SqlDbType.NChar, 10, "ASOther_GROSSAC").Value = Server.HtmlEncode(txtBox53);
 
        TextBox ASOtherNETACTB = (TextBox)FormView1.FindControl("ASOther_NETACTB");
        string txtBox54 = ASOtherNETACTB.Text.Trim();
        com.Parameters.Add("@ASOther_NETAC", SqlDbType.NChar, 10, "ASOther_NETAC").Value = Server.HtmlEncode(txtBox54);
 
        TextBox ASOtherOVERLAPTB = (TextBox)FormView1.FindControl("ASOther_OVERLAPTB");
        string txtBox55 = ASOtherOVERLAPTB.Text.Trim();
        com.Parameters.Add("@ASOther_OVERLAP", SqlDbType.NChar, 10, "ASOther_OVERLAP").Value = Server.HtmlEncode(txtBox55);
 
        TextBox ASOtherTAXPARCELIDTB = (TextBox)FormView1.FindControl("ASOther_TAXPARCELIDTB");
        string txtBox56 = ASOtherTAXPARCELIDTB.Text.Trim();
        com.Parameters.Add("@ASOther_TAXPARCELID", SqlDbType.NChar, 10, "ASOther_TAXPARCELID").Value = Server.HtmlEncode(txtBox56);
 
        TextBox AdInformationTB = (TextBox)FormView1.FindControl("AdInformationTextBox");
        string txtBox57 = AdInformationTB.Text.Trim();
        com.Parameters.Add("@AdInformation", SqlDbType.NVarChar, 50, "AdInformation").Value = Server.HtmlEncode(txtBox57);
 
        TextBox EN_OrigDocumentIMG_DESCTB = (TextBox)FormView1.FindControl("EN_OrigDocumentIMG_DESCTextBox");
        string txtBox58 = EN_OrigDocumentIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_OrigDocumentIMG_DESC", SqlDbType.NVarChar, 50, "EN_OrigDocumentIMG_DESC").Value = Server.HtmlEncode(txtBox58);
 
        TextBox EN_ClosingSettIMG_DESCTB = (TextBox)FormView1.FindControl("EN_ClosingSettIMG_DESCTextBox");
        string txtBox59 = EN_ClosingSettIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_ClosingSettIMG_DESC", SqlDbType.NVarChar, 50, "EN_ClosingSettIMG_DESC").Value = Server.HtmlEncode(txtBox59);
 
        TextBox EN_RecordedMemIMGTB = (TextBox)FormView1.FindControl("EN_RecordedMemIMG_DESCTextBox");
        string txtBox60 = EN_RecordedMemIMGTB.Text.Trim();
        com.Parameters.Add("@EN_RecordedMemIMG_DESC", SqlDbType.NVarChar, 50, "EN_RecordedMemIMG_DESC").Value = Server.HtmlEncode(txtBox60);
 
        TextBox EN_OccRentIMG_DESCTB = (TextBox)FormView1.FindControl("EN_OccRentIMG_DESCTextBox");
        string txtBox61 = EN_OccRentIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_OccRentIMG_DESC", SqlDbType.NVarChar, 50, "EN_OccRentIMG_DESC").Value = Server.HtmlEncode(txtBox61);
 
        TextBox EN_AcqDispApprIMG_DESCTB = (TextBox)FormView1.FindControl("EN_AcqDispApprIMG_DESCTextBox");
        string txtBox62 = EN_AcqDispApprIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_AcqDispApprIMG_DESC", SqlDbType.NVarChar, 50, "EN_AcqDispApprIMG_DESC").Value = Server.HtmlEncode(txtBox62);
 
        TextBox EN_DiscStateIMG_DESCTB = (TextBox)FormView1.FindControl("EN_DiscStateIMG_DESCTextBox");
        string txtBox63 = EN_DiscStateIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_DiscStateIMG_DESC", SqlDbType.NVarChar, 50, "EN_DiscStateIMG_DESC").Value = Server.HtmlEncode(txtBox63);
 
        TextBox EN_NonForeignAffIMG_DESCTB = (TextBox)FormView1.FindControl("EN_NonForeignAffIMG_DESCTextBox");
        string txtBox64 = EN_NonForeignAffIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_NonForeignAffIMG_DESC", SqlDbType.NVarChar, 50, "EN_NonForeignAffIMG_DESC").Value = Server.HtmlEncode(txtBox64);
 
        TextBox EN_OwnersAffIMG_DESCTB = (TextBox)FormView1.FindControl("EN_OwnersAffIMG_DESCTextBox");
        string txtBox65 = EN_OwnersAffIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_OwnersAffIMG_DESC", SqlDbType.NVarChar, 50, "EN_OwnersAffIMG_DESC").Value = Server.HtmlEncode(txtBox65);
 
        TextBox EN_1009SIMG_DESCTB = (TextBox)FormView1.FindControl("EN_1009SIMG_DESCTextBox");
        string txtBox66 = EN_1009SIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_1009SIMG_DESC", SqlDbType.NVarChar, 50, "EN_1009SIMG_DESC").Value = Server.HtmlEncode(txtBox66);
 
        TextBox EN_PaintDiscIMG_DESCTB = (TextBox)FormView1.FindControl("EN_PaintDiscIMG_DESCTextBox");
        string txtBox67 = EN_PaintDiscIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_PaintDiscIMG_DESC", SqlDbType.NVarChar, 50, "EN_PaintDiscIMG_DESC").Value = Server.HtmlEncode(txtBox67);
 
        TextBox EN_TitleOpinIMG_DESCTB = (TextBox)FormView1.FindControl("EN_TitleOpinIMG_DESCTextBox");
        string txtBox68 = EN_TitleOpinIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_TitleOpinIMG_DESC", SqlDbType.NVarChar, 50, "EN_TitleOpinIMG_DESC").Value = Server.HtmlEncode(txtBox68);
 
        TextBox EN_PhotosIMG_DESCTB = (TextBox)FormView1.FindControl("EN_PhotosIMG_DESCTextBox");
        string txtBox69 = EN_PhotosIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_PhotosIMG_DESC", SqlDbType.NVarChar, 50, "EN_PhotosIMG_DESC").Value = Server.HtmlEncode(txtBox69);
 
        TextBox EN_ApprIMG_DESCTB = (TextBox)FormView1.FindControl("EN_ApprIMG_DESCTextBox");
        string txtBox70 = EN_ApprIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_ApprIMG_DESC", SqlDbType.NVarChar, 50, "EN_ApprIMG_DESC").Value = Server.HtmlEncode(txtBox70);
 
        TextBox EN_MapIMG_DESCTB = (TextBox)FormView1.FindControl("EN_MapIMG_DESCTextBox");
        string txtBox71 = EN_MapIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_MapIMG_DESC", SqlDbType.NVarChar, 50, "EN_MapIMG_DESC").Value = Server.HtmlEncode(txtBox71);
 
        TextBox EN_AdditionalIMG_DESCTB = (TextBox)FormView1.FindControl("EN_AdditionalIMG_DESCTextBox");
        string txtBox72 = EN_AdditionalIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_AdditionalIMG_DESC", SqlDbType.NVarChar, 50, "EN_AdditionalIMG_DESC").Value = Server.HtmlEncode(txtBox72);
 
        TextBox EN_DocFowLaterIMG_DESCTB = (TextBox)FormView1.FindControl("EN_DocFowLaterIMG_DESCTextBox");
        string txtBox73 = EN_DocFowLaterIMG_DESCTB.Text.Trim();
        com.Parameters.Add("@EN_DocFowLaterIMG_DESC", SqlDbType.NVarChar, 4000, "EN_DocFowLaterIMG_DESC").Value = Server.HtmlEncode(txtBox73);
 
        TextBox Prep_ByTextBoxTB = (TextBox)FormView1.FindControl("Prep_ByTextBox");
        string txtBox74 = Prep_ByTextBoxTB.Text.Trim();
        com.Parameters.Add("@Prep_By", SqlDbType.NVarChar, 50, "Prep_By").Value = Server.HtmlEncode(txtBox74);
        
        FileUpload file1 = (FileUpload)FormView1.FindControl("FileUpload1");
        if (file1.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file1.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_OrigDocumentIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file2 = (FileUpload)FormView1.FindControl("FileUpload2");
        if (file2.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file2.PostedFile.FileName));
            file2.PostedFile.SaveAs(strPath);
        }
        com.Parameters.Add("@EN_ClosingSettIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file3 = (FileUpload)FormView1.FindControl("FileUpload3");
        if (file3.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file3.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_RecordedMemIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file4 = (FileUpload)FormView1.FindControl("FileUpload4");
        if (file4.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file4.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_OccRentIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file5 = (FileUpload)FormView1.FindControl("FileUpload5");
        if (file5.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file5.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_AcqDispApprIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file6 = (FileUpload)FormView1.FindControl("FileUpload6");
        if (file6.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file6.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_DiscStateIMG", strPath);
 
 
 
        
        strPath = string.Empty;
        FileUpload file7 = (FileUpload)FormView1.FindControl("FileUpload7");
        if (file7.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file7.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_NonForeignAffIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file8 = (FileUpload)FormView1.FindControl("FileUpload8");
        if (file8.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file8.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_OwnersAffIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file9 = (FileUpload)FormView1.FindControl("FileUpload9");
        if (file9.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file9.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_1009SIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file10 = (FileUpload)FormView1.FindControl("FileUpload10");
        if (file10.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file10.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_PaintDiscIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file11 = (FileUpload)FormView1.FindControl("FileUpload11");
        if (file11.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file11.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_TitleOpinIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file12 = (FileUpload)FormView1.FindControl("FileUpload12");
        if (file12.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file12.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_PhotosIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file13 = (FileUpload)FormView1.FindControl("FileUpload13");
        if (file13.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file13.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_ApprIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file14 = (FileUpload)FormView1.FindControl("FileUpload14");
        if (file14.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file14.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_MapIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file15 = (FileUpload)FormView1.FindControl("FileUpload15");
        if (file15.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file15.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_AdditionalIMG", strPath);
 
        
        strPath = string.Empty;
        FileUpload file16 = (FileUpload)FormView1.FindControl("FileUpload16");
        if (file16.HasFile)
        {
            strPath = (Server.MapPath("images/") + Path.GetFileName(file16.PostedFile.FileName));
        }
        com.Parameters.Add("@EN_DocFowLaterIMG", strPath);
 
        
        try
        {
            intResult = Convert.ToInt32(com.ExecuteNonQuery());
 
            if (intResult != 0)
            {
                if (file1.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file1.PostedFile.FileName));
                    file1.SaveAs(strPath);
                }
 
                if (file2.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file2.PostedFile.FileName));
                    file2.SaveAs(strPath);
                }
                
                
                if (file3.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file3.PostedFile.FileName));
                    file3.SaveAs(strPath);
                }
                
                if (file4.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file4.PostedFile.FileName));
                    file4.SaveAs(strPath);
                }
 
                if (file5.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file5.PostedFile.FileName));
                    file5.SaveAs(strPath);
                }
 
                if (file6.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file6.PostedFile.FileName));
                    file6.SaveAs(strPath);
                }
 
                if (file7.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file7.PostedFile.FileName));
                    file7.SaveAs(strPath);
                }
 
                if (file8.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file8.PostedFile.FileName));
                    file8.SaveAs(strPath);
                }
 
                if (file9.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file9.PostedFile.FileName));
                    file9.SaveAs(strPath);
                }
 
                if (file10.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file10.PostedFile.FileName));
                    file10.SaveAs(strPath);
                }
 
                if (file11.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file11.PostedFile.FileName));
                    file11.SaveAs(strPath);
                }
 
                if (file12.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file12.PostedFile.FileName));
                    file12.SaveAs(strPath);
                }
 
                if (file13.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file13.PostedFile.FileName));
                    file13.SaveAs(strPath);
                }
 
                if (file14.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file14.PostedFile.FileName));
                    file14.SaveAs(strPath);
                }
 
                if (file15.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file15.PostedFile.FileName));
                    file15.SaveAs(strPath);
                }
 
                if (file16.HasFile)
                {
                    strPath = (Server.MapPath("images/") + Path.GetFileName(file16.PostedFile.FileName));
                    file16.SaveAs(strPath);
                }
 
                Response.Write("Records Entered and Images Uploaded.");
            }
            else
            {
                Response.Write("No images uploaded.");
            }
        }
        catch
        {
            Response.Write("Failed to upload images.  There was a database error.");
        }
    }
}

Open in new window

GravitaZ24Asked:
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.

Juan_BarreraCommented:
HI,

By "binding to a database" you mean to update the database? If so, you are already doing it when you call com.ExecuteNonQuery().

Otherwise, can you explain a bit more what are you trying to do?

Cheers,


0
GravitaZ24Author Commented:
I'm sorry, I wrote the question kind of fast, I have a control that has dynamic dropdown lists, with the county dependent on the state, The database updates on a button event. I'm just not sure how to write the code in c# to find the SelectedValue of the dropdowns and update the database with those values.
0
Juan_BarreraCommented:
Ok, I think I understand:

  // If you can access the control directly:
        string ddlcountyvalue = ddlCounty.SelectedValue;
        
        //Otherwise, if it's inside the control, and you have to find it like the Textboxes
         DropDownList ddl = (DropDownList)FormView1.FindControl("OfficeTextBox");
         string ddlcountyvalue = ddl.SelectedValue;
        
        //Then, populate the parametetr
        com.Parameters.Add("@NameOfParam", SqlDbType.NVarChar, 50, "NameOfParam").Value = ddlcountyvalue;

Open in new window

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
GravitaZ24Author Commented:
Thank you that worked perfectly, I was making it more complicated than it had to be, I made a separate control for the dropdown menus and I didn't even have to Thanks!
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.

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.