 |
| ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

March 3rd, 2006, 05:23 PM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Page Not Posting
I have a page that contains 4 Drop Downs, with their own connections each connect to a different Sql Table and binds. If I add a 5th drop down the page will not post back to the server on click. I have never seen this before and have several sites that have more than 4 Drop Downs on them and they work fine. Puzzled
What Do You Mean It Does Not Work
__________________
What Do You Mean It Does Not Work
|
|

March 4th, 2006, 01:27 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
On click? of a button, or the selected index changed event
|
|

March 6th, 2006, 10:53 AM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
On Selection Change
Quote:
quote:Originally posted by jbenson001
On click? of a button, or the selected index changed event
|
What Do You Mean It Does Not Work
|
|

March 6th, 2006, 12:14 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Make sure you have autopostback = TRUE on the ddl.
|
|

March 6th, 2006, 03:21 PM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Autopostback is = True, If I select the from the combo more that 2 times then the form will not post back when I select from the combo box, or when I click the Submit button
What Do You Mean It Does Not Work
|
|

March 6th, 2006, 03:39 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
what is the code that binds the ddl, and the selectedindexchanged event code?
|
|

March 6th, 2006, 03:55 PM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I will let you look at all of it. This nothing that I have never done before! The page just stops posting.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (Page.IsPostBack) = False Then
Dim MyUserID = Session("UserID")
Dim MyVendorName = Session("VendorName")
Dim ConSQL As New SqlClient.SqlConnection
Dim ConSQL2 As New SqlClient.SqlConnection
Dim ConSQL4 As New SqlClient.SqlConnection
Dim connectionString As String
Dim user As String = System.Configuration.ConfigurationSettings. _
AppSettings("mappedname")
Dim pass As String = System.Configuration.ConfigurationSettings. _
AppSettings("mappedkey")
connectionString = "data source=DCW32L31;initial catalog=OrderedItems"
connectionString &= ";user id=" & user
connectionString &= ";password=" & pass
ConSQL.ConnectionString = connectionString
ConSQL2.ConnectionString = connectionString
ConSQL4.ConnectionString = connectionString
Dim myOrder As Integer
myOrder = 0
Me.txtAmntOrdered.Text = myOrder
Me.txtAmntOrdered.Style("Text-Align") = "right"
ConSQL.Open()
Dim ItemSql As New SqlClient.SqlCommand
ItemSql.Connection = ConSQL
ItemSql.CommandText = "SELECT ItemType FROM tblItemType ORDER BY ItemType ASC;"
Dim ItemRead As SqlClient.SqlDataReader
ItemRead = ItemSql.ExecuteReader()
Me.ddlItemType.DataSource = ItemRead
Me.ddlItemType.DataValueField = "ItemType"
Me.ddlItemType.DataTextField = "ItemType"
Me.ddlItemType.DataBind()
Me.ddlItemType.Items.Insert(0, New ListItem("-Select Item-", "0"))
ItemRead.Close()
ConSQL.Close()
''''''''''''''''''''''''''''''''''''''''''''''''
ConSQL2.Open()
Dim VendorSql As New SqlClient.SqlCommand
VendorSql.Connection = ConSQL2
VendorSql.CommandText = "SELECT VendorName FROM tblVendor ORDER BY VendorName ASC;"
Dim VendorRead As SqlClient.SqlDataReader
VendorRead = VendorSql.ExecuteReader()
Me.ddlVendorName.DataSource = VendorRead
Me.ddlVendorName.DataValueField = "VendorName"
Me.ddlVendorName.DataTextField = "VendorName"
Me.ddlVendorName.DataBind()
Me.ddlVendorName.Items.Insert(0, New ListItem("-Select Vendor-", "0"))
VendorRead.Close()
ConSQL2.Close()
'''''''''''''''''''''''''''''''''''''''''''''''
ConSQL4.Open()
Dim StatusSql As New SqlClient.SqlCommand
StatusSql.Connection = ConSQL4
StatusSql.CommandText = "SELECT OrderStatus FROM tblOrderStatus ORDER BY OrderStatus ASC;"
Dim StatusSqlRead As SqlClient.SqlDataReader
StatusSqlRead = StatusSql.ExecuteReader()
Me.ddlOrderStats.DataSource = StatusSqlRead
Me.ddlOrderStats.DataValueField = "OrderStatus"
Me.ddlOrderStats.DataTextField = "OrderStatus"
Me.ddlOrderStats.DataBind()
Me.ddlOrderStats.Items.Insert(0, New ListItem("-Select-", "0"))
StatusSqlRead.Close()
ConSQL4.Close()
'''''''''''''''''''''''''''''''''''''''''''''''
End If
Me.txtItemReqested.Text = Me.ddlItemType.SelectedValue
End Sub
Private Sub ddlVendorName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlVendorName.SelectedIndexChanged
Dim ObjConn As New SqlClient.SqlConnection
Dim adaptSQL As New SqlClient.SqlDataAdapter
Dim connectionString As String
Dim user As String = System.Configuration.ConfigurationSettings. _
AppSettings("mappedname")
Dim pass As String = System.Configuration.ConfigurationSettings. _
AppSettings("mappedkey")
connectionString = "data source=DCW32L31;initial catalog=OrderedItems"
connectionString &= ";user id=" & user
connectionString &= ";password=" & pass
ObjConn.ConnectionString = connectionString
ObjConn.Open()
Dim myVendorSrch As String
myVendorSrch = Me.ddlVendorName.SelectedValue
Dim ds As New DataSet
adaptSQL = New SqlClient.SqlDataAdapter("SELECT VendorPoc,VendorPhoneNum FROM tblVendor WHERE VendorName = '" & myVendorSrch & "'", ObjConn)
adaptSQL.Fill(ds, "dtVendorSearch")
Try
Dim objDataTable As DataTable
Dim objDataRows() As DataRow
Dim objDataRow As DataRow
For Each objDataRow In ds.Tables(0).Rows
objDataTable = ds.Tables("dtVendorSearch")
Me.txtVendorPoc.Text = objDataRow("VendorPoc")
Me.txtVendorPnum.Text = objDataRow("VendorPhoneNum")
Next
Catch
Exit Sub
End Try
ObjConn.Close()
Me.txtVendorPnum.Style("text-align") = "right"
End Sub
Private Sub ddlItemType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlItemType.SelectedIndexChanged
Dim ConSQL As New SqlClient.SqlConnection
Dim ConSQL1 As New SqlClient.SqlConnection
Dim ConSQL2 As New SqlClient.SqlConnection
Dim connectionString As String
Dim user As String = System.Configuration.ConfigurationSettings. _
AppSettings("mappedname")
Dim pass As String = System.Configuration.ConfigurationSettings. _
AppSettings("mappedkey")
connectionString = "data source=DCW32L31;initial catalog=OrderedItems"
connectionString &= ";user id=" & user
connectionString &= ";password=" & pass
ConSQL.ConnectionString = connectionString
ConSQL1.ConnectionString = connectionString
ConSQL2.ConnectionString = connectionString
If Me.txtItemReqested.Text = "Laptop" Then
ConSQL.Open()
Dim LaptopSql As New SqlClient.SqlCommand
LaptopSql.Connection = ConSQL
LaptopSql.CommandText = "SELECT Description FROM tblLaptops ORDER BY Description ASC;"
Dim LaptopRead As SqlClient.SqlDataReader
LaptopRead = LaptopSql.ExecuteReader()
Me.ddlItemDesription.DataSource = LaptopRead
Me.ddlItemDesription.DataValueField = "Description"
Me.ddlItemDesription.DataTextField = "Description"
Me.ddlItemDesription.DataBind()
Me.ddlItemDesription.Items.Insert(0, New ListItem("-Select Item-", "0"))
LaptopRead.Close()
ConSQL.Close()
ElseIf Me.txtItemReqested.Text = "Monitor" Then
ConSQL1.Open()
Dim MonitorSql As New SqlClient.SqlCommand
MonitorSql.Connection = ConSQL1
MonitorSql.CommandText = "SELECT Description FROM tblMonitors ORDER BY Description ASC;"
Dim MonitorRead As SqlClient.SqlDataReader
MonitorRead = MonitorSql.ExecuteReader()
Me.ddlItemDesription.DataSource = MonitorRead
Me.ddlItemDesription.DataValueField = "Description"
Me.ddlItemDesription.DataTextField = "Description"
Me.ddlItemDesription.DataBind()
Me.ddlItemDesription.Items.Insert(0, New ListItem("-Select Item-", "0"))
MonitorRead.Close()
ConSQL1.Close()
ElseIf Me.txtItemReqested.Text = "Printer" Then
ConSQL2.Open()
Dim PrinterSql As New SqlClient.SqlCommand
PrinterSql.Connection = ConSQL2
PrinterSql.CommandText = "SELECT Description FROM tblPrinter ORDER BY Description ASC;"
Dim PrinterRead As SqlClient.SqlDataReader
PrinterRead = PrinterSql.ExecuteReader()
Me.ddlItemDesription.DataSource = PrinterRead
Me.ddlItemDesription.DataValueField = "Description"
Me.ddlItemDesription.DataTextField = "Description"
Me.ddlItemDesription.DataBind()
Me.ddlItemDesription.Items.Insert(0, New ListItem("-Select Item-", "0"))
PrinterRead.Close()
ConSQL2.Close()
End If
Me.ddlPrCreated.Items.Add(New ListItem("-Select-"))
Me.ddlPrCreated.Items.Add(New ListItem("Yes"))
Me.ddlPrCreated.Items.Add(New ListItem("No"))
Me.ddlPrApproved.Items.Add(New ListItem("-Select-"))
Me.ddlPrApproved.Items.Add(New ListItem("Yes"))
Me.ddlPrApproved.Items.Add(New ListItem("No"))
End Sub
Private Sub ddlItemDesription_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlItemDesription.SelectedIndexChanged
Dim ObjConn As New SqlClient.SqlConnection
Dim adaptSQL As New SqlClient.SqlDataAdapter
Dim connectionString As String
Dim user As String = System.Configuration.ConfigurationSettings. _
AppSettings("mappedname")
Dim pass As String = System.Configuration.ConfigurationSettings. _
AppSettings("mappedkey")
connectionString = "data source=DCW32L31;initial catalog=OrderedItems"
connectionString &= ";user id=" & user
connectionString &= ";password=" & pass
ObjConn.ConnectionString = connectionString
Dim myTblName As String
If Me.txtItemReqested.Text = "Scanner" Then
myTblName = "tblScanner"
ElseIf Me.txtItemReqested.Text = "Printer" Then
myTblName = "tblPrinter"
ElseIf Me.txtItemReqested.Text = "Laptop" Then
myTblName = "tblLaptops"
ElseIf Me.txtItemReqested.Text = "Camera" Then
myTblName = "tblCamera"
ElseIf Me.txtItemReqested.Text = "Software" Then
myTblName = "tblSoftware"
ElseIf Me.txtItemReqested.Text = "Projector" Then
myTblName = "tblProjector"
ElseIf Me.txtItemReqested.Text = "Desktop" Then
myTblName = "tblDesktop"
ElseIf Me.txtItemReqested.Text = "Network Device" Then
myTblName = "tblNetworkDevice"
ElseIf Me.txtItemReqested.Text = "Monitor" Then
myTblName = "tblMonitors"
ElseIf Me.txtItemReqested.Text = "Network Equipment" Then
myTblName = "tblNetworkEquipment"
End If
Dim myDescription As String
myDescription = Me.ddlItemDesription.SelectedValue
ObjConn.Open()
Dim ds As New DataSet
adaptSQL = New SqlClient.SqlDataAdapter("SELECT Price_Per_Unit,Quanity_of_Issue FROM " & myTblName & " WHERE Description = '" & myDescription & "'", ObjConn)
adaptSQL.Fill(ds, "dtItemSpecs")
Try
Dim objDataTable As DataTable
Dim objDataRows() As DataRow
Dim objDataRow As DataRow
For Each objDataRow In ds.Tables(0).Rows
objDataTable = ds.Tables("dtItemSpecs")
Me.txtUnitPrice.Text = objDataRow("Price_Per_Unit")
Me.txtQntyIssue.Text = objDataRow("Quanity_of_Issue")
Next
Catch
Exit Sub
End Try
ObjConn.Close()
Me.txtUnitPrice.Style("text-align") = "right"
End Sub
What Do You Mean It Does Not Work
|
|

March 6th, 2006, 03:59 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Humm this is strange..the code looks fine.. maybe just try deleting the 5th ddl that has the problem.. and recreate it.
|
|

March 7th, 2006, 11:55 AM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Alright I must come clean and admit my DUMB #@@ mistake, always make sure within your Form HTML Tag Method that it = "post" not "get", that makes a world of difference, and I just knew the .NET Gremlins had taken over my machine
What Do You Mean It Does Not Work
|
|

March 7th, 2006, 12:26 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Glad you found it..!! but how did it get set to get, by default the designer sets it to post.. unless you created it from scratch?
|
|
 |