473,405 Members | 2,310 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,405 software developers and data experts.

Filling One DataGrid Based on Selection from Another DataGrid - Both in Separate User Controls

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.

What I need is for the selected row in the first DataGrid to be used as
input to another query that dynamically fills the second DataGrid. This
second DataGrid is in the second user control. I'm having trouble doing
this. Any suggestions????

In my first user control, I have the item command event for the first
DataGrid as such:

private void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs
e)
{
if (e.CommandName == "SelectMasterReport")
{
// get the selected value needed using e.Item.Cells[3].Text
// code here to populate the second DataGrid?????
}
}

Thanks in advance for any help!
Nov 19 '05 #1
1 2100
Ok, here is my explanation....

We have 3 parts: 1) .aspx 2). Main .ascx 3). sencondary .ascx

First thing to do (which you have done already) is load the main .ascx
(datagrid). I imagine that you are exposing the DataSource property of the
datagrid on the main .ascx control.

Next, you will have to create a bubble event within the main .ascx control
so that ItemCommand event of the datagrid will bubble up to the .aspx page.
Create properties of the data you need in order to fill the 2nd Datagrid

Now you have the event that fires in the .aspx page, capture the properties
that you set in the .ascx control and set the DataSource property of the
second .ascx control.

Seems like the only step you are missing is bubbling up the ItemCommand
event from the main .ascx control to the .aspx page......and creating and
grabbing the data from the main .ascx control and use it to set the
DataSource property of the second .ascx control.

Hope this helps !
"thegame" wrote:
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.

What I need is for the selected row in the first DataGrid to be used as
input to another query that dynamically fills the second DataGrid. This
second DataGrid is in the second user control. I'm having trouble doing
this. Any suggestions????

In my first user control, I have the item command event for the first
DataGrid as such:

private void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs
e)
{
if (e.CommandName == "SelectMasterReport")
{
// get the selected value needed using e.Item.Cells[3].Text
// code here to populate the second DataGrid?????
}
}

Thanks in advance for any help!

Nov 19 '05 #2

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

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
0
by: Rob | last post by:
I am attempting to update a number of combo boxes on a form based on the users selection in the data grid I want the user to be able to select multiple items Using a separate button I can loop...
3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
6
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on...
5
by: I am Sam | last post by:
I have a rather complicated problem I need to sort out and wonder if anyone can assist me. The ingredients: Two DropDownList Controls One DataGrid Purpose of Page:
2
by: Joanne | last post by:
Hi, I have an "interesting" problem with UserControls in a datagrid and I'm desperate for your help as I work alone and have no-one else to ask. It is quite complicated but I'll try to keep it...
12
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
3
by: Phillip N Rounds | last post by:
I have a DataGrid in a web form (ASP1.1, C#, VS 2003) that I'm trying to add some functionality to, and I can't figure out how to do int. The existing DataGrid has several databound columns and a...
0
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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...
0
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,...
0
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...

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.