6 Answers, 1 is accepted
You can prevent populating the grid (placed in user control) for each items by setting the Visible property of grid on user control to "false". When the grid's Visible property is set to false, the NeedDataSource event of grid will not fire.
In ItemCommand event of parent grid, access the grid placed iin user control and set the Visible property to "True" and call the Rebind() method, which in turn invoke the NeedDataSource event to populate the grid. Here is the sample code.
Hope this suggestion helps,
I am not sure about the issue that you described. I did experience a similar issue after I added "e.item.Expanded =false;" as in your code.
Could you please elaborate on the issue that you are facing?
thnx for response
in commanitem of master grid , i made some changes .
scenario which i want is liek user can open only one nested view template at a time which i achived using foreach loop i set all items expanded to false .
now if any item is expanded if i click on same item it should be closed which i am not getting
i checked the condition as stated in previous post code snippet .
issue i am facing is it goes to else part execute the statement "e.item.Expanded =false; " but it didnt set it as collapsed .it remain expanded.
thnx in advance :)
Thank you very much for this post. I initially placed my codes inside the ItemDataBound Event of the RadGrid, I could not find my user control, but with your post, I moved my code to ItemCommand which I actually suspected my help, the my codes worked.
protected void grdView_ItemCommand(object source, GridCommandEventArgs e)
if (e.CommandName == RadGrid.ExpandCollapseCommandName)
var grid = (ASP.app_idd_usercontrol_oduediligenceaudittrail_ascx) ((GridDataItem) e.Item).ChildItem.FindControl("oDueDiligenceAuditTrail");
long lRequestId = long.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["REQUESTID"].ToString());