473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Filling Datagrids based on dropdown

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?

Nov 7 '07 #1
0 1055

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Philip Townsend | last post by:
I have a datagrid that contains a dropdown list that is part of an EditItemTemplate. I need to run some code when the dropdown list builds in order to preselect an item in the list. Preselecting...
0
by: Brian Conway | last post by:
Does anyone know of a way to dynamically update the contents in a datagrid based off of what someone would pick in a dropdown box on the same page? Basically look for a way to take the values out...
2
by: DC Gringo | last post by:
This code has two SELECT statements, each returning several records. I want to fill a dataset and then two datagrids. How would I fill the SECOND datagrid from this code ----- Sub...
1
by: Philip Townsend | last post by:
I have a datagrid that contains a dropdown list that is part of an EditItemTemplate. I need to run some code when the dropdown list builds in order to preselect an item in the list. Preselecting...
3
by: Jim Bancroft | last post by:
Hi everyone, I'd like to put some DropDownLists in my DataGrid, populating each from a database query. I'm having a little trouble naming them based on the current record in the DataSet. For...
1
by: thegame | last post by:
Filling One DataGrid Based on Selection from Another DataGrid - Both in Separate User Controls Hello, I have an interesting dilemma. I have an ASPX page with two user controls (two ASCXs). ...
5
by: tshad | last post by:
Here is the DropDown: <asp:DropDownList ID="ScreenTest" runat="server" /> Here is the code: ScreenTest.DataSource=objCmd.ExecuteReader ScreenTest.DataValueField="ScreenTemplateMasterID"...
13
by: Oliver Hauger | last post by:
Hello, In my html form I show a select-element and if this element is clicked I fill it per JavaScript/DOM with option-elements. I use the following code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD...
6
by: Steve Hershoff | last post by:
Hi everyone, I've got a strange one here. There are two datagrids on my page, one nested within the other. I'll refer to them as the topmost and secondary datagrids. In the topmost...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.