Solved

How to call event in child datagrid?

Posted on 2014-01-23
5
377 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

Independent Software Vendors: 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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

705 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