Master Details in two seperate GridView Controls - .NET 2.0 (VS.NET 2005)

I am simply trying to have a list of people in the top grid control (works fine), then when selected have the second Grid Control show details for that person(not working).

Here is what I am trying from the load event:



Dim myConnection As New MySql.Data.MySqlClient.MySqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionSql"))

Dim strPersonSQL, strActSQL As String

strPersonSQL =

"select row_id, first_name, last_name, middle_initial, dsi_id, created, created_by, program_of_study, email from tbl_person"

Dim myPerCommand As New MySqlClient.MySqlCommand(strPersonSQL, myConnection)

Dim myPerDA As New MySqlClient.MySqlDataAdapter(myPerCommand)


myPerDA.Fill(ds, "Person")


grdPerson.DataSource = ds.Tables("Person")


End Sub


Protected Sub grdPerson_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdPerson.SelectedIndexChanged

grdActivty.DataSource = getDetails(grdPerson.DataKeys(grdPerson.SelectedIndex).ToString())


End Sub




getDetails(ByVal propertyID As Integer) As System.Data.DataSet

'1 Create Connection

Dim myConnection As New MySql.Data.MySqlClient.MySqlConnection(System.Configuration.ConfigurationManager.AppSettings("ConnectionSql"))

Label1.Text = propertyID

'2 Create command

Dim strActSQL As String

strActSQL =

"SELECT a.par_per_id, a.description, a.area_of_concern, a.course_name, a.meeting_flg, a.confirmed_signature_flg, a.pr_location FROM ewns.tbl_activity a, ewns.tbl_person p WHERE ((a.par_per_id = p.row_id) AND (a.par_per_id = @propertyID))"

Dim myActCommand As New MySqlClient.MySqlCommand '(strActSQL, myConnection)

myActCommand.CommandText = strActSQL

myActCommand.Connection = myConnection

Dim dbParam_propertyID As System.Data.IDataParameter = New MySql.Data.MySqlClient.MySqlParameter

dbParam_propertyID.ParameterName =


dbParam_propertyID.Value = propertyID

dbParam_propertyID.DbType = System.Data.DbType.Int32



Dim myActDA As New MySqlClient.MySqlDataAdapter '(myActCommand)

myActDA.SelectCommand = myActCommand

Dim ds As System.Data.DataSet = New System.Data.DataSet


Return ds

End Function
12/29/2006 4:31:18 AM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 19

Change like this; 

Dim myActDA As New MySqlClient.MySqlDataAdapter (myActCommand, myConnection)


12/29/2006 10:40:26 AM
Outstanding,,,Thx for the help
12/30/2006 5:39:48 AM

Similar Artilces:

(master/detail) control using gridview and formview controls problem...
hi guys, i'm new to .net programming and have been toying with the (master/detail) control using gridview and formview controls...however, i can't seem to drilldown to the correct record when the primary key is a composite key. please help....   <asp:GridView ID="GridView1" runat="server" DataKeyNames="ServiceID,VersionNum" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None"               &nbs...

How to: 2.0 Encrypting Field Data Using a Formview Control and a Gridview control for SQL
The Exercise: Using a Formview Control and a Gridview control to Encrypt data going into SQL, Decrypt it for display, and Be able to Edit it. Using Visual Studio 2005 ASP.NET 2.0 Framework   Files needed: – QSEnc64.vb to be placed in the App_Code folder of your application TestInsertEdit.aspx in the root of the application TestInsertEdit.aspx.vb in the root of the application A Web Config file with a valid ConnectionString Your_SQLConnectionString A SQL Database that you can add the test table to (see script below)   Hopefully this exercise will save you the time it to...

1.1 vs. 2.0 differences - disabled child controls in a User Control - span tags
We have a user control that has a panel with some checkboxes on it (via a data driven checkboxlist).  The panel starts out disabled.  The checkboxes are set to enabled.  As expected, because the checkboxes are on the panel, they are not enabled when the page paints.  The user can enable the panel via client side javascript.Under 1.1, this enbales all of the checkboxes.Under 2.0 the checkboxes remain disabled. This is using the same source code and the same compiled dlls.  All I have to do to get the different behaviors is set the version of ASP.NET under IIS for...

Master/Detail update problems: Setting SelectedIndex in "Master" GridView doesn't force "Detail" controls to refresh
I have a master grid which is populated with the results of a "Last Name" search. 2 detail GridViews and a BulletList are then populated on selection of a row in the master GridView. I would like to:a) If only one "Last Name" is returned in a master Gridview, automatically "Select" it. b) When popping up a child window to enter master and/or detail records, force the parent window to refresh itself and re-select the original master record when the child window is closed. Additionally, I would like the detail GridViews, which are "paged", to jump to the page where the...

Do we still need to code Fill methods for Data Source controls of VS 2005/ASPnet 2.0?
Since Feb. 2007, I have been working on VS 2005/ASPnet 2.0 with some existing old VS 2002/2003/ASPnet 1.0/1.1 codes. The website completed in this project has been working well for the past 2 months.   This website coded with new GridView data-bound controls, along with the old DataGrid controls.  Therefore, ADOnetobjects (Connection, Command, DataReader, and Adapter) were utilized to interact with the DataSets through the Fillmethods, and we usually have had many long aspx.vb files.  Meanwhile, I have started to learn how to create a new website from the VS 2005 Toolbox,...

Master/Detail Form using Gridview and Details View controls
There are useful codes in the following page: Introducing the ASP.NET 2.0 GridView and DetailsView Controls used code under Listing 12. Creating a Master/Detail Form and everything worked fine. But when I clicked the master record to view the details I am getting a server error message "Cannot find column [@EmployeeID]" Where did I go wrong? Can anybody clarify?...

trouble with master grid controling detail formview and detail gridview
I have two tables, temp and photo.  Temp contains an a number of fields including ID, and sessionID.  ID is an identity field and a primary key.  Photo contains a number of fields including sessionID, which is neither an identity field nor a primary key.All my datasources are linqdatasources.Gridview1 displays a subset of the temp table.  Formview1 displays all the fields in temp where ID == @ID.  So far so good.  Gridview2 displays some of the fields in photo where sessionID == @sessionID.  Gridview2 always comes up empty.I tried looking for the record whe...

Master/Detail Using a Selectable Master GridView with a Details DetailView,Master/Detail Using a Selectable Master GridView with a Details DetailView
Hello , My name is Patrick, I write to you from Peru, I saw an article about Master/Detail Using a Selectable Master GridView with a Details DetailView here is, i did all what it says ow you this example with one data keycolumns but I have more than one , i select all Data key Columns in The master GridView and i tested but when i select a row only takes the value of the fisrt datakey, the other ones takes the same value, nothing appears in the details Gridview, please help me, I don't know what to do, I execute my sql query string and it's working fine, tell me what ...

HTML controls vs Web Controls #2
    Hi All,   What is the differnce between HTML controls and web controls?   Some of the things which could be done by web application, could also be   be done by Web Controls.   So, why HTML controls are being provided.   What is the use of that having two different controls web controls and HTML controls?   Regards Abdul      The main difference is the Web Server Controls are generated on the server side and turned into HTML and can be used in the code behind, the HTML controls are just static HTML markup. The S...

Linking a Details View control to a Gridview Control
Can anyone tell me how to connect a details view control to a gridview control?  I'm trying to display certain fields in a details view, when a user clicks Select in the Gridview.   Thanks Hello, do you want to go to a new page or do you want to have it displayed inside of the gridview? or maybe under the gridview control?Still in search of the far side.--------------------------------A code snippet may help you, but a reference to the doc will teach you something for later...Don't just try to solve somebody's problem with a snippet, teach him how to solve it. U...

gridview control in another gridview control
Hi ia have a questioni have a gridview control which contains button in one my question is i need another gridview to be placed in the  first gidviewso that when i click on the button the second gridview will populate the my question is how to place second gridview in first gridview.or is there any approach like first grid itself acting as parent and child.please help me  Hi sirikalavalapalli:                I think nested gridview will help you. Check this link and it will show you how...

Cannot install Toolbox with VS 2005 -error message: Control cannot be created because Visual Studio cannot find the control's type in the control assembly.
I unzipped the toolkit, and followed the instructions on the setup page to add the controls but when I try to create a control (double-clicking the control in the toolbox) I get the error message: Control cannot be created because Visual Studio cannot find the control's type in the control assembly.  I have the April release of Atlas.  I tried adding the AtlasControlToolkit to the bin folder of my website but that didn't help. Hi - Another user reported this problem but has some steps to resolve it: Could you try those steps and r...

Getting the control id of a control inside gridview control
 uhmm.. a little bit confusing regarding my subject because i dont know how to say the way my problem is how can i get the id of a control (e.g. textbox) inside the gridview... and the textbox is in the templatefield... is there any way i can get its id??  hoping i could get a reply as soon as possible... Regards,MhaeyPlease remember to click “Mark as Answer” on the post that helps you.. =) What do you want's to do by getting the id of the Text box? Do you want's to find particular Textbox with certain id ? Kamran ShahidSr. Software Engineer(MCP,,MC...

Dynamically loading a control inside a control (2.0)
Hi, I'm trying to dynamically load a WebUserControl inside a WebUserControl. This can be done using the LoadControl method, but I need to set properties of the control and do not know how to do this if I use LoadControl. Another way would be to create an instance of the control and then set the properties, but I cannot access the control programmatically inside another control. I saw some tip about putting the codebehind of the control in the App_Code folder, but this doesn't help: I get a compilation error since the codefile then cannot access controls declared in the ascx part of the...

Having problem modifying controls with new DNN 2.0.1 and DNN 2.0.2
Has something changed in the DNN 2.0.1 and DNN 2.0.2 releases of DNN that will not allow changes to the DesktopModules? In DNN 2.0.0 I was able to go and modify the EditContact.ascx file and place the following fields on the form. Last Name: First Name: Department: I made all the change to the database table and the stored procedures. I made the changes to the ContactsDB files as well as the changes to the DataProvider file and the SqlDataProvider file. In version DNN 2.0.0 the modified contacts form works like a champ I changed the Contacts form to show the three new fields...

Web resources about - Master Details in two seperate GridView Controls - .NET 2.0 (VS.NET 2005) -

Wii online play may use seperate friend codes for each game. Also: new DS Pokemon will feature VoIP
As we gaze into our online gaming crystal ball, we see much numerical text …

Recalls: Jaguar recalls 7k F-Types for two seperate issues with electrical system
Filed under: Convertible , Coupe , Sedan , Recalls , Jaguar , Luxury Jaguar is the latest automaker to join in on the recall action from this ...

China's Alibaba is Spinning Off its Aliyun OS Into a Seperate Business Unit
China's Alibaba bolsters its own mobile OS with $200M investment

Mariah Carey And Nick Cannon’s Glitter-Coated Marriage Is Probably Dead And They’re Living In Seperate ...
It feels like over the past 12 months, there have been a billion barely-even blind items (more like near-sighted items or items in which you ...

The Tea Party And Progressives Speak Seperate Languages In A Divided America
The state no longer mirrors the nation, but possesses a separate identity and sadly, its own agenda.

China Opens Seperate Walking Lane For People Texting
In an effort to raise awareness of the dangers of walking and texting, China has opened separate walkways for people who are using their cell ...

Clint And Dina Eastwood Seperate After 17 Years Of Marriage
Clint and Dina Eastwood have separated, having been married for 17 years. Dina is Clint’s second wife. On Friday, People magazine reported on ...

Le Mans Qualifying Red-Flagged Twice For Four Seperate Accidents
Le Mans qualifying was red-flagged for 45 minutes as the #71 AF Corse Ferrari went off at the Porsche Curves. No word on injuries but the driver ...

Bobby Flay and Stephanie March Seperate :
"There have been problems for a while, so this was inevitable," a source tells PEOPLE

Singer k.d. lang Seperates From Domestic Partner Jaime Price
TMZ is reporting that out singer k.d. lang has finally dissolved her two-year domestic partnership with girlfriend Jamie Price. Lang, one of ...

Resources last updated: 12/31/2015 6:31:19 AM