Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Processing Help Needed

Status
Not open for further replies.

emblewembl

Programmer
May 16, 2002
171
GB
Hi, I am just starting asp.net and have a question about forms. At the moment I have a page which starts off showing one drop down menu. The user selects one of the three values and immediately a new drop down menu is shown below (using a placeholder) and it is populated with values relevant to the selection they made. The user then needs to choose from the new dropdown menu. In this system I will need to pass the users choices through to a new page, display them on screen and have the user complete another form. I am a bit stuck as to how to do this and wondered if someone could give me some examples. Here is the html for my form so far :
Code:
<form runat=&quot;server&quot;>
Choose Customer : 
<asp:DropDownList id=&quot;OurDropDown&quot; runat=&quot;Server&quot; AutoPostBack=&quot;true&quot; DataTextField=&quot;HireNo&quot;></asp:DropDownList>
<br /><br />
<asp:Label id=&quot;TextAddress&quot; runat=&quot;Server&quot;></asp:Label>
<asp:Placeholder id=&quot;AddressPlaceHolder&quot; runat=&quot;Server&quot;></asp:Placeholder>
</form>

And my code is :
Code:
Sub Page_Load(sender As Object, e As EventArgs)

    If IsPostBack Then

       Dim Sales_Ledger_Code As String

       Sales_Ledger_Code = OurDropDown.SelectedItem.Text

       TextResults.Text = &quot;Text: &quot; & OurDropDown.SelectedItem.Text & &quot;<br>&quot;
       TextResults.Text += &quot;Value: &quot; & OurDropDown.SelectedItem.Value & &quot;<br>&quot;

       GetQuoteRef()
       GetDeliveryAddress(Sales_Ledger_Code)

     Else

       Datasub()

     End If

     DateToday.Text = today

End Sub


Sub DataSub()

    Dim OurConnection as SQLConnection
    Dim OurCommand as SQLCommand
    Dim OurDataReader as SQLDataReader
    Dim DatabaseDetails as String

    DatabaseDetails = &quot;Server=PROJSQLSERV;uid=scott;pwd=5096;database=Chambers_Runfold_SQL_Ver1&quot;

    OurConnection = New SQLConnection(DatabaseDetails)

    OurCommand = New SQLCommand(&quot;SEL_Customer_Sales_Ledger_Identities&quot;, OurConnection)
    OurCommand.CommandType = CommandType.StoredProcedure
    OurConnection.Open()

    OurDataReader = OurCommand.ExecuteReader()

    OurDropDown.DataSource = OurDataReader
    OurDropDown.DataTextField = &quot;Sales_Ledger_Code&quot;
    OurDropDown.DataValueField = &quot;Sales_Ledger_Code&quot;
    OurDropDown.Databind()

    OurDataReader.Close()
    OurConnection.Close()

End Sub

Sub GetDeliveryAddress(strSales_Ledger_Code)

    Dim AddressArray As new Arraylist()
    Dim AddressDrop As new DropDownList()

    Dim OurConnection as SQLConnection
    Dim OurCommand as SQLCommand
    Dim OurDataReader as SQLDataReader
    Dim DatabaseDetails as String

    DatabaseDetails = &quot;Server=PROJSQLSERV;uid=scott;pwd=5096;database=Chambers_Runfold_SQL_Ver1&quot;

    OurConnection = New SQLConnection(DatabaseDetails)

    OurCommand = New SQLCommand(&quot;SEL_Customer_Delivery_Addresses&quot;, OurConnection)
    OurCommand.CommandType = CommandType.StoredProcedure

    OurCommand.Parameters.Add(New SQLParameter(&quot;@sales_ledger_code&quot;,strSales_Ledger_Code))

    OurConnection.Open()

    OurDataReader = OurCommand.ExecuteReader()

    AddressDrop.DataSource = OurDataReader
    AddressDrop.DataTextField = &quot;Address&quot;
    AddressDrop.DataValueField = &quot;Site_Identity_Number&quot;
    AddressDrop.Databind()

    OurDataReader.Close()
    OurConnection.Close()

    AddressPlaceHolder.Controls.Add(AddressDrop)

    TextAddress.Text = &quot;Choose Delivery Address : &quot;
End Sub

Can someone point me in the right direction? I would also welcome any other pointers on mycode!!

Thanks!
i love chocolate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top