Hi,
I've been spending hours over a problem I can't seem to resolve.
I have populated a hierarchical webgrid with a custom collection containing 2 bands. I added the code to populate the webgrid on page load and everything works fine. I'm able to click on the '+' button and drill down into the details.
However, when I moved the code(to populate the grid) into a button click event, this is what happens:
1) I load the page - grid is empty
2) I click on the button, - grid is loaded
I'm still able to see the '+' button, but when I click on it, nothing happens. It changes to '-' but the sub webgrid doesn't appear. clicking on it further does nothing, the '-' doesn't even change back to '+'.
My page load event is empty.
The only other code I have is in the InitializeLayout event which consists of : UltraWebGrid1.DisplayLayout.LoadOnDemand = LoadOnDemand.Automatic;
I have tried adding this line of code into page load and in my button click event, but the problem still persists.
Please help!
PS: I'm using Infragistics 7.1
When the LoadOnDemand is set to Automatic, it requires the DataBind() to be called on each and every postback. Please visit the following link to learn more about all the enumerations of LoadOnDemand:
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2009.1/CLR3.5/html/Infragistics35.WebUI.UltraWebGrid.v9.1~Infragistics.WebUI.UltraWebGrid.LoadOnDemand.html
Since UpdatePanel is used, I would suggest to handle the InitializeDataSource event on the server side of the grid and assign the datasource of the Grid in this event handler. This event is raised for every async callback and for every postback. The DataBind() is implicitely called after the executing InitializeDataSource. Here is an example of InitializeDataSource event:
protected void UltraWebGrid1_InitializeDataSource(object sender, Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs e)
{
this.UltraWebGrid1.DataSource = myList;
}
Please modify the code and let me know if you have any issues.
Thanks
Sarita
Bump, does anyone know? I think it's some postback issue, but I can't resolve this.
I just noticed another odd behaviour.
I moved the code back into page load, and encompassed it within if(!Page.IsPostBack) { }, and problem occured.
This is how my code looks like:
UltraWebGrid1.DataSource = requestList;
UltraWebGrid1.DisplayLayout.ViewType = Infragistics.WebUI.UltraWebGrid.ViewType.Hierarchical;
UltraWebGrid1.DataBind();
It works completely fine without if (!Page.IsPostBack) { }
All my controls are in an ASP.NET Update Panel. I tried removing the update panel, but it still yield the same results.
Can anyone ascertain what the problem might be?