Solved

How to call event in child datagrid?

Posted on 2014-01-23
5
371 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
  • 3
  • 2
5 Comments
 
LVL 39

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 39

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 39

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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 …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now