VB.NET 2002/2003 BasicsFor coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.
You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
I have a datalist that bind several dropdownlists from various tables. Well two of the dropdownlist are dependent upon the other. For example, if ddl1.SelectedValue = "1" then ddl2.selectedvalue = '01'. If ddl1.SelectedValue ="2" then ddl2.selectedvalue = '02'. If it was outside of a datalist then I would have no problem doing it. But instead this datalist is really throwing me off. Any suggestions. I'm not sure whether or not to use ItemDataBound or dlSelectedIndexChange. Here my code that I have thus far. Right now it's throwing the error "Object reference not specified" on the line
'prmCauseDetail.Value = ddlcausetype.SelectedItem.Value'
Private Sub BindCauseDetails(ByVal ddl As DropDownList)
connFF = New SqlConnection(Application("connFF"))
Dim ddlcausetype As DropDownList
Dim intCounter As Integer
Dim ddlCauseDetails As DropDownList
Dim cmdCauseDetails As New SqlCommand("spFFGetCauseDetails", connFF)
cmdCauseDetails.CommandType = CommandType.StoredProcedure
Dim prmCauseDetail As New SqlParameter("@CauseType", SqlDbType.VarChar)
prmCauseDetail.Value = ddlcausetype.SelectedItem.Value
cmdCauseDetails.Parameters.Add(prmCauseDetail)
Catch er As Exception
LogError(er.ToString, "CauseDetails-Incident.aspx")
Exit Try
Finally
connFF.Close()
End Try
End Sub
Sub dlIncident_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dlIncident.SelectedIndexChanged
Dim ddlCausedetails As DropDownList
BindCauseDetails(ddlCausedetails)
End Sub