Friday, 7 March 2008
Validators and hidden fields
If the field that is being validated is hidden in some circumstances a Java error " 'null' is null or not a object"
This doesn't happen on all servers / clients, the problem on site was produced on the clients IIS but on our one wasn't showing, this is with the same code running.
It also didn't happen with a previous version that had one less validator.
The solution was to move the validators next to the actual fields that were being validated. The validation messages were being shown in a validator summary.
The only way I could reproduce it in the office, was to move the post buttons off the Update panel and to do a full postback. This error continued to happen on site, even if I disabled the validators for the hidden control.s
Tuesday, 12 February 2008
IIS Asp.Net (Apparently) Bizzarro (turns out) lack of understanding
Had apparently strange goings on with IIS & Asp.Net.
Delivered new mylibrary.dll. User renamed mylibrary.dll to "old mylibrary.dll", copied in new mylibrary.dll. Got error saying 'old mylibrary.dll' could not be loaded into manifest.
After deleting the 'old mylibrary.dll' files the web site loaded ok.
After a discussion we came to the conclusion that IIS loads all the DLL files in the BIN directory irrespective of references within Web.Config.
The site then throws exception when two dlls contain the same Assembly-name - this also makes sense.
So what appeared to be strange behaviour came down to not thinking logically!
Monday, 4 February 2008
Asp.Net Ajax Calendar Extender
There is a bug with the AJAX calendar extender in that the style of the popup calendar are not applied if the text-box /calendar extender are hidden when a page first loads.
e.g. Panel with Details on is only shown once valid record found; if the first calendar extender on the page is within this hidden Details panel the calendar will not be displayed correctly when Details does become visible:
To fix this have a hidden calendar extender at top of the page:
<!-- Workaround for Calendar not displaying correctly - if hidden when page first loads -->
<div style="display: none"><asp:TextBox runat="server" ID="textbox1" /><cc1:CalendarExtender ID="ceTextBox1" runat="server" TargetControlID="textbox1" /></div>
Calendar is then displayed correctly:
Monday, 28 January 2008
Crystal Reports Asp.Net issues
Deployed Crystal Reports to server by:
Run CRRedist2005_x86.msi (taken from C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports\)
Icons did not display in CR Toolbar:
Copy C:\Inetpub\wwwroot\aspnet_client to root of website)
ADO provider not found (SQL Server 2000):
Report (design-time) connection was SQL-Native changed to be SQLOLEDB.
Change connection information at run-time
CrystalDecisions.Shared.TableLogOnInfo tliCurrent;
foreach (CrystalDecisions.CrystalReports.Engine.Table tbCurrent in crSource.ReportDocument.Database.Tables)
{
tliCurrent = tbCurrent.LogOnInfo;
tliCurrent.ConnectionInfo.ServerName = server;
tliCurrent.ConnectionInfo.UserID = username;
tliCurrent.ConnectionInfo.Password = password;
tliCurrent.ConnectionInfo.DatabaseName = dbname;
tbCurrent.ApplyLogOnInfo(tliCurrent);
}
Toolbar Not working
The toolbar options were not working because a post-back was being generated that performs the functionality - the assigning of the report was within a !IsPostBack block. As the report is not held in state it must be reloaded during post back.
Monday, 21 January 2008
NHibernate transaction locking oops!
Was testing catching NHibernate.StaleObjectStateException (exception where one user updates a record which another user then attempts to update without getting newer version).
Was getting 'Failed to initialise lazy..." when reloading record on associated collection due to a timeout and also appeared to be locking the server (no queries could be run on tables involved in failed update)
It came down to the transaction not being Rolled-back when exception thrown - so obviously DB still in transaction.
Monday, 26 November 2007
Databinding NHibernate
Had a few problems data-binding lists returned from NHibernate (queries or collections) where the first object in the list was a proxy. We previously 'fixed' this by clearing the session prior to running the query. This then caused further problems as objects were detached and the lazy-lists threw exceptions.
The solution we came to is based on : This posting by Ayende
A TypeDescriptor was created for EntityBase (all our objects returned from NHibernate inherit from EntityBase) which was registered with the web-site in the Global.asax Application_StartUp.
Thursday, 22 November 2007
Configuration Error: FairmortRoleProvider
When creating a new site we kept getting spurious errors which seemed to relate to "add name=FairmortRoleProvider...." line of Web.Config.
This was a red herring and the actual error related to Spring Config files and references. The Salecore assemblies that are to be referenced must be added as a reference AND the relevant config files also added. Either missing reference or config file can cause this spurious error.