473,657 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=Micro soft.Jet.OLEDB. 4.0;data
source=" & Server.MapPath( "dbCS_Skills.md b")
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(EM P_Name_SQL, dbconn)
Dim objDR As OleDbDataReader
objDR = dbCMD.ExecuteRe ader
If Not Page.IsPostBack Then
Employee_Name.D ataSource = objDR
Employee_Name.D ataBind()
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 1072

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

Similar topics

0
1619
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 the item is not the problem. The problem is that the dropdown object is not instantiated at the point at which the Edit button is clicked, or at any other obvious step in the process. In other words, when a user clicks the Edit (EditCommand)...
0
888
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 of the dropdown box and pass into a query that will populate the datagrid based off that selected value.
2
1361
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 BindSQL() Dim MyConnection As SqlConnection Dim DS as DataSet
1
1725
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 the item is not the problem. The problem is that the dropdown object is not instantiated at the point at which the Edit button is clicked, or at any other obvious step in the process. In other words, when a user clicks the Edit (EditCommand)...
3
1197
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 example, here's a snippet of what I have now in my DataGrid <ItemTemplate> <asp:DropDownList runat="server" id="lstCategories"
1
2116
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). Both ASCXs have DataGrids on them. The first user control's DataGrid is populated from our database on page load. The DataGrid also has a Select LinkButton.
5
1669
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" ScreenTest.DataTextField= "ScreenName" ScreenTest.databind() ScreenTest.Items.Insert(0, new ListItem("Select Screen Test",0))
13
2346
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 HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head>
6
1741
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 datagrid's OnItemDataBound() method we check for the row in which it's appropriate to add the secondary datagrid. Exactly one row in the topmost grid will contain the secondary grid.
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8730
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7321
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.