473,394 Members | 1,746 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,394 software developers and data experts.

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
(OnSelectedIndexChanged). I can get the ItemIndex of the dropdownlist
using this code below:

((DataGridItem)((DropDownList)Sender).NamingContai ner).ItemIndex;

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).NamingContai ner.Parent.FindControl("LineItemGrid")).ItemIndex;

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

Thanks a lot.

Nov 19 '05 #1
1 2380
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)((DataGridItem)((DropDow nList)Sender).NamingContainer).NamingContainer).Na mingContainer).ItemIndex;
--
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
(OnSelectedIndexChanged). I can get the ItemIndex of the dropdownlist
using this code below:

((DataGridItem)((DropDownList)Sender).NamingContai ner).ItemIndex;

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).NamingContai ner.Parent.FindControl("LineItemGrid")).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
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...
0
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...
7
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...
1
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...
1
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...
1
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. -- .....
0
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...
0
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...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.