Filling Datagrids based on dropdown

J

Jim

OK here's my disclaimer: I'm very new to ASP.NET and posting on Google
Groups, so please bear with me and feel free to correct either the way
I code or the way I post.

I have an ASP.NET page that is driven off of a dynamic dropdownlist
control. In the page_load sub, I make the DB connection and fill the
list based on a table of employees. Once an employee is selected,
there are various datagrids below that are populated based on that
employee. Here is my page_load sub:

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim strconn As String = "Provider=Microsoft.Jet.OLEDB.4.0;data
source=" & Server.MapPath("dbCS_Skills.mdb")
Dim dbconn = New OleDbConnection(strconn)
dbconn.open()
Dim EMP_Name_SQL As String = "SELECT tblEmployee.EMP_NAME FROM
[tblEmployee] GROUP BY tblEmployee.EMP_NAME;"
Dim dbCMD As New OleDbCommand(EMP_Name_SQL, dbconn)
Dim objDR As OleDbDataReader
objDR = dbCMD.ExecuteReader
If Not Page.IsPostBack Then
Employee_Name.DataSource = objDR
Employee_Name.DataBind()
BindData()
End If
dbconn.close()
objDR.Close()
End Sub


Employee_Name is my dropdownlist control. BindData is a separate sub
that populate all of the datagrids. This is not working properly, and
I know it is because it is in the Not IsPostBack condition. The
AutoPostBack attribute of the dropdownlist is set to true, so my
thinking was move the BindData() call to a IF Page.IsPostBack
statement? I tried that, but then if I try to edit anything in my
DataGrids, I get an "Invalid postback or callback argument" error.

Does anyone have any recommendations?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top