Solved

How to call event in child datagrid?

Posted on 2014-01-23
5
375 Views
Last Modified: 2014-01-30
I know we can use Itembound event of a datagrid to perform an action.
But when I have child datagrid in a datagrid, how can I raise event for child datagrid?
0
Comment
Question by:RajG1978
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 39806897
when binding your child grid, you would wire up the events there.

An article showing nested gridviews:
http://www.codeproject.com/Articles/685079/Nested-GridView-in-ASP-NET-using-Csharp
0
 

Author Comment

by:RajG1978
ID: 39807054
I am not comfortable with jquery, is there a way we can do this ASP.net itself, instead of using jquery?
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 39807415
Yeah . . .

you can manually add events.

for instance during the parent databind:

{
   myChildGrid.DataSource = MyDataTable;
   myChildGrid.OnDataBind += myChildGrid_DataBind;
   myChildGrid.DataBind();
  // other things to do in parent databind
 
}

protected void MyChildGRid_Databind(object sender, EventArgs e)
{
   // add child logic here.
}
0
 

Author Comment

by:RajG1978
ID: 39810606
as per my understanding above code will add child datagrid to parent. How can I call events for child datagrid. For instance, I am deleting a row in child datagrid, how do I raise this event for child grid from parent grid.
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 39812340
Hi Raj,

You are correct, it would add the events to be fired from the front end.

However if you're deleting the row the event would be fired from the child data grid, not the parent datagrid.

http://miroprocessordev.blogspot.com/2012/04/how-to-fire-rowcommand-event-of-nested.html#!/2012/04/how-to-fire-rowcommand-event-of-nested.html

If you wanted to call the child from the parent you could call the same functions, or just update the db and then rebind the data for that row.

I hope that helps.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question