473,667 Members | 2,749 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nested datagrid event firing - item index of parent grid

Hello,

I have a datagrid within another datagrid. The innder datagrid
contains a dropdownlist which fires an event as index change
(OnSelectedInde xChanged). I can get the ItemIndex of the dropdownlist
using this code below:

((DataGridItem) ((DropDownList) Sender).NamingC ontainer).ItemI ndex;

This returns the ItemIndex of the dropdownlist of the inner datagrid.
However, I need to know the ItemIndex of the outter datagrid (the
parent datagrid) where the event is firing. So I use the following
code, but it did not work.

((DataGridItem) ((DropDownList) Sender).NamingC ontainer.Parent .FindControl("L ineItemGrid")). ItemIndex;

What should I do to get the ItemIndex of the parent datagrid.

Thanks a lot.

Nov 19 '05 #1
1 2400
Hi Andy,

The NamingContainer to the child DataGridItem is the child DataGrid; the
NamingContainer to the latter is the parent DataGridItem that you are trying
to access.

((DataGridItem) ((DataGrid)((Da taGridItem)((Dr opDownList)Send er).NamingConta iner).NamingCon tainer).NamingC ontainer).ItemI ndex;
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Andy" wrote:
Hello,

I have a datagrid within another datagrid. The innder datagrid
contains a dropdownlist which fires an event as index change
(OnSelectedInde xChanged). I can get the ItemIndex of the dropdownlist
using this code below:

((DataGridItem) ((DropDownList) Sender).NamingC ontainer).ItemI ndex;

This returns the ItemIndex of the dropdownlist of the inner datagrid.
However, I need to know the ItemIndex of the outter datagrid (the
parent datagrid) where the event is firing. So I use the following
code, but it did not work.

((DataGridItem) ((DropDownList) Sender).NamingC ontainer.Parent .FindControl("L ineItemGrid")). ItemIndex;

What should I do to get the ItemIndex of the parent datagrid.

Thanks a lot.

Nov 19 '05 #2

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

Similar topics

2
17005
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of the columns of the data grid contains a DropDownlist. I managed to create this datagrid control as follows.
0
2259
by: Chad Folden | last post by:
I can't figure out how to use the EditCommand for the nested datagrid .. HELP PLEASE ;-) It works perfectly for the parent datagrid, but will not display, even though the EditCommand event is firing for the child datagrid. I have set up a test page for myself to see if I can get this to work ..any help is appreciated! Thanks in advance (This is my complete page and code behind) <asp:DataGrid ID="_dgProj" AllowPaging=False
7
2271
by: Lars Netzel | last post by:
If I put a checkbox in a datagrid (ASP.NET) and set the Autopostback to true I can catch OnChange event on checkbox but how do I then catch what DataGridItemIndex is? Can I use some Event in the Datagrid that will fire off when the Checkbox is changed? regards /Lars
1
1967
by: Roy | last post by:
How is it done? BTW, I'm reposting this here, as the datagrid newsgroup appears functionally comatose... I have a nested datagrid setup. When one updates the child grid using edit, it also updates a field in the parent grid (the parent grid update is done using a simple select query inside the child grid's update sub). All is well, *however* after the update occurs the parent grid is still displaying the old data even though the update...
1
2100
by: Peter Rilling | last post by:
I have an interesting problem with a datagrid. It is the standard chicken-and-the-egg problem. I have this page with two datagrids. It essentially defines a parent-child relationship. The parent grid has a "edit" and "delete" columns. When the "edit" link button is clicked, I want the child grid to display some information related to the parent. Now the child grid also has some command buttons. My problem is that I cannot get the...
1
2358
by: jimb | last post by:
I can get the dropdownlist into the datagrid, and I can populate it, but I can't read it. Anybody have a working example of a dropdownlist in an editable grid? Thanks. -- .. http://sf-f.org, weblog and search engine for fans and writers of
0
1695
by: Chris | last post by:
I've been searching all over and think I am close, but keep getting the error "Index out of range" when trying to reference a nested datagrid when an OnEditCommand event is raised. When the OnEditCommand event is raised, I try to do the following: 1. Find the selected datalist item in which the nested datagrid raised the event. (by calling getDataGridReference and returning the DataList's selectedIndex)
0
2078
by: rupalirane07 | last post by:
Both grids displays fine. But the problem is only parent datagrid sorting works fine but when i clik on child datagrid for sorting it gives me error: NullReferenceException error Any help........pls urgent ========================================================= <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm3.aspx.vb" Inherits="TestDatagrids.WebForm3"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">...
0
2719
by: JamesOo | last post by:
I have the code below, but I need to make it searchable in query table, below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only, cannot serch by combine 3 table) Example I have the query table below, how do I make the code to seach based on the query from this: SELECT Product.ID, Product.Description, Quantity.Quantity, Quantity.SeialNo, Quantity.SupplierID,...
0
8366
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
8888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
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
7391
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
6206
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
5677
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();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2779
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
1779
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.