How to call event in child datagrid?

Posted on 2014-01-23
Medium Priority
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?
Question by:RajG1978
  • 3
  • 2
LVL 41

Expert Comment

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

An article showing nested gridviews:

Author Comment

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

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;
  // other things to do in parent databind

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

Author Comment

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.
LVL 41

Accepted Solution

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.


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.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
From store locators to asset tracking and route optimization, learn how leading companies are using Google Maps APIs throughout the customer journey to increase checkout conversions, boost user engagement, and optimize order fulfillment. Powered …

586 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