A small oversight (at least in my mind) in the ESB Portal quickly proves to become a major irritant after using it for awhile. The default sort order on the faults page is by severity, which if you’re like me, is almost never the logical choice when viewing the page. I would much rather be seeing it sorted by the time when the fault occurred and if I want to view the data any other way I can always change the sort order or apply filters.
The ESB portal uses an ASP.Net Grid and it’s default implementation doesn’t specify a sort order, thus on page load it will always sort by it’s first column which is severity. Thus you’ve got two choices, either change the order of the columns, or add some new behavior which defines the default sort behavior. I’ve explored the latter path.
In order to make the changes, you’ll want to open the ESB.Portal solution, expand the ESB.Portal project, and within that open the FaultList.ascx.cs file which is in the Lists directory (you’ll have to expand FaultList.ascx to see the .cs file). You’re interested in the very first method – Page_Load. You’ll want to add in the highlighted code from the below screenshot.
If you haven’t previously installed the portal then you can perform a build and use the msi installer package to deploy the portal. If you have previously installed the portal and got it working then chances are you don’t want to start from scratch and only want to apply the updated dlls. These would be the Microsoft.Practices.ESB.Portal.dll and Microsoft.Practices.ESB.Portal.XmlSerializers.dll files in the bin folder of your ESB.Portal project, and you’ll want to copy them to your bin folder of the ESB Portal folder that is used to host your IIS virtual application.
You can always take this a bit further and read in the default sort order from the web.config file if you want to make this more configurable, and you can of course replace DateTime in the Fault.Sort() method call with any SortingOrer you want.
Edit 26th March 2012 : Updated the code snippet to implement the default sorting since I found that the previous code caused an exception when the grid did not contain any rows.
LikeLike
Hi Johann,
I have an issue with alerts paging, when i try to display the second page i get the following error :
Server Error in /ESB.Portal Application.
The GridView “GridView1” fired event PageIndexChanging which wasn’t handled.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The GridView ‘GridView1’ fired event PageIndexChanging which wasn’t handled.
Do you have any idea about how to fix the problem ?
Thanks for your help.
Best regards
LikeLike
Hi Tarik,
I have not seen that specific error before. It is most likely an issue with the data in your database not being handled well by the portal.
I would suggest you look to run the portal in debug mode while running against an export of the database causing you trouble and see where it falls over.
Chances are that you will either have to adjust the source code for the portal so that it caters for this specific data requirement or you will have to flush the specific record(s) that is causing you trouble. Of course a possible approach would be to flush the entire database (there are third-party cleanup scripts available if you search online) as that will almost surely get you up and running.
Let me know if you need more guidance or specifics and good luck.
Cheers
Johann
LikeLike
I have the exact same problem when trying to move onto the next page of the audit log. The interesting thing here is that even if you implement the PageIndexChanging event it never fires even though the event log leads you in that direction.
LikeLike
This fixes it:
protected void GridView1_PageIndexChanging(object sender, System.Web.UI.WebControls.GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
BindGrid();
}
LikeLike
Reblogged this on John Glisson – Geek of the Cloth and commented:
Helpful…
LikeLike