Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
!IsPostBack test causes cast error while saving
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00890299
Message ID:
00890404
Vues:
15
Neil,

>The problem occurs when I attempt to wrap the 4 read-only Business Objects and their queries in a “!IsPostBack” construct.

I think you want to do something like this instead:
// Instantiate look-up (read-only) business objects		
//register labwork bizobj
this.oLabWork = (LabWork)this.RegisterBizObj(new LabWork());
    
//register letterlog bizobj
this.oLetterLog = (LetterLog)this.RegisterBizObj(new LetterLog());

//register guarantor bizobj
this.oGuarantor = (Guarantor)this.RegisterBizObj(new Guarantor());

//register model bizobj
this.oModel = (Model)this.RegisterBizObj(new Model());

if (!IsPostBack)
{
    // populate look-up (read-only) datasets and persist across application
    //  populate the LetterLog Dataset for this patient
    Session["dsLetterLog"] = this.oLetterLog.GetLetterLogByptno(custid);
						
    // populate the LabWork DataSet for this patient
    Session["dsLabWork"] = this.oLabWork.GetLabWorkBycustno(custid);

    //  populate the Guarantor Dataset for this patient
    Session["dsGuarantor"] = this.oGuarantor.GetGuarantorBycustno(custid);

    //populate the Model Dataset for this patient
    Session["dsModel"] = this.oModel.GetModelBycustno(custid);
}
If I understand what you're doing, you want your business objects to be instantiated and registered whether or not you're posting back or not.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform