Postbacks with parent/child datagrid controls

D

Danny Sikora

Hello,

I have a datagrid on a .aspx page, and another datagrid on a .ascx page. My
goal is to populate the "child" datagrid (the one from the control) depending
on the selected index of the parent datagrid. The child control gets the
DataKeyField of the selected index of the datagrid from the parent page to
use to populate it's datagrid.

So, when I call a sort, edit, or whatever from the child datagrid, it fires
a postback to the parent page, and so I have to reload the control in the
page_load area of of the parent page....fine so far.

My problem comes when I select a new item from the parent datagrid. The
page posts back, and then it reloads my child control, but it still has the
ID from the previously selected Item because it reloads the control before it
fires the DataGrid.OnSelectCommand function.

I tried to clear the placeholder that I load the control into, and reload
the control. This sort-of works...at this point there is 2 controls (one
loaded from page_load, and one from the selected index changed), but only one
is visible.

Is there a way to actually DELETE or UNLOAD a control from the page or
placeholder, and actually reload it, as opposed to the placeHolder.Clear()
function?

Thanks,

Danny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top