emblewembl
Programmer
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 :
And my code is :
Can someone point me in the right direction? I would also welcome any other pointers on mycode!!
Thanks!
i love chocolate
Code:
<form runat="server">
Choose Customer :
<asp:DropDownList id="OurDropDown" runat="Server" AutoPostBack="true" DataTextField="HireNo"></asp:DropDownList>
<br /><br />
<asp:Label id="TextAddress" runat="Server"></asp:Label>
<asp:Placeholder id="AddressPlaceHolder" runat="Server"></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 = "Text: " & OurDropDown.SelectedItem.Text & "<br>"
TextResults.Text += "Value: " & OurDropDown.SelectedItem.Value & "<br>"
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 = "Server=PROJSQLSERV;uid=scott;pwd=5096;database=Chambers_Runfold_SQL_Ver1"
OurConnection = New SQLConnection(DatabaseDetails)
OurCommand = New SQLCommand("SEL_Customer_Sales_Ledger_Identities", OurConnection)
OurCommand.CommandType = CommandType.StoredProcedure
OurConnection.Open()
OurDataReader = OurCommand.ExecuteReader()
OurDropDown.DataSource = OurDataReader
OurDropDown.DataTextField = "Sales_Ledger_Code"
OurDropDown.DataValueField = "Sales_Ledger_Code"
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 = "Server=PROJSQLSERV;uid=scott;pwd=5096;database=Chambers_Runfold_SQL_Ver1"
OurConnection = New SQLConnection(DatabaseDetails)
OurCommand = New SQLCommand("SEL_Customer_Delivery_Addresses", OurConnection)
OurCommand.CommandType = CommandType.StoredProcedure
OurCommand.Parameters.Add(New SQLParameter("@sales_ledger_code",strSales_Ledger_Code))
OurConnection.Open()
OurDataReader = OurCommand.ExecuteReader()
AddressDrop.DataSource = OurDataReader
AddressDrop.DataTextField = "Address"
AddressDrop.DataValueField = "Site_Identity_Number"
AddressDrop.Databind()
OurDataReader.Close()
OurConnection.Close()
AddressPlaceHolder.Controls.Add(AddressDrop)
TextAddress.Text = "Choose Delivery Address : "
End Sub
Can someone point me in the right direction? I would also welcome any other pointers on mycode!!
Thanks!
i love chocolate