?
Solved

How to call event in child datagrid?

Posted on 2014-01-23
5
Medium Priority
?
382 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 2000 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

Industry Leaders: 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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

771 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