Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Web Form
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Divers
Thread ID:
01409563
Message ID:
01409584
Vues:
36
Eric,

You can't skip the page_Load as the web apps are a stateless environment and page_Load always has to run and always will run on a Post Back. What is the 'GetOrderbyID' method returning when it gets run? Does the same situation occur when you find an existing order and when you attempt to add a new order using NewEntity method?

>The btnSave_Click looks like this:
>
>
>  protected void btnSave_Click(object sender, System.EventArgs e)
>    {
>        DataSet dsOrder = (DataSet)Session["dsOrder"];
>
>        if (this.Save(this.oOrder, dsOrder, this.oOrder.TableName) ==
>           mmSaveDataResult.RulesPassed)
>        {
>            Response.Redirect("Contact.aspx?Id=" + this.iContactId);
>        }
>    }
>
>
>When I put a breakpoint after the first line, all the values in the dsOrder dataset are null (or default), which seems to be because it got reset at the bottom of the page_Load method that ran right before this. Do I want it to skip the page_Load when I save?
>
>Thanks,
>
>Eric
>
>
>
>>Eric,
>>
>>Everything looks good to me, but I don't know what your btnSave_Click method looks like.
>>
>>Do you have the following code somewhere near the top of this method:
>>
>>
>>DataSet dsOrder = (DataSet)Session["dsOrder"];
>>
>>
>>>I'm clearly missing something simple. I have a web form that I'd like to use for new sales as well as editing existing sales. My page load looks like this:
>>>
>>>    protected void Page_Load(object sender, EventArgs e)
>>>    {
>>>//      EventGolf oEvent = new Wala.Membership.Business.EventGolf();
>>>//      mmBindingList<EventGolfEntity> oGolfEvents = oEvent.GetAllEntities();   
>>>        this.oOrder = (Reg_Golf)this.RegisterBizObj(new Reg_Golf());
>>>        this.oFee = (Fee)this.RegisterBizObj(new Fee());
>>>        this.iContactId = int.Parse(String.IsNullOrEmpty(Request.QueryString["ContactId"]) ? "0" : Request.QueryString["ContactId"]);
>>>
>>>        this.iOrderId = int.Parse(String.IsNullOrEmpty(Request.QueryString["OrderId"]) ? "0" : Request.QueryString["OrderId"]);
>>>        
>>>        // Retrieve the specified order and detail
>>>        if (! this.oOrder.getOrderById(this.iOrderId))
>>>        {
>>>            this.oOrder.NewEntity();
>>>            this.oOrder.Entity.numIndID = this.iContactId;
>>>        }
>>>        Session["dsOrder"] = this.oOrder.DataSet;
>>>
>>>My save button is defined like this:
>>>
>>> <mm:mmButton ID="btnSave" runat="server" AccessLevel="Full" BindingSource="" BindingSourceMember=""
>>>            ControlID="00000000-0000-0000-0000-000000000000" IsPostBack="False" SecuritySetup="True"
>>>            Text="Save Sale" UserFieldName="" onclick="btnSave_Click" 
>>>                    UseSubmitBehavior="False" />
>>>
>>>
>>>Note that useSubmitBehavior and isPostBack are false. When I click on the save button, it's still posting back, which is wiping out my Session["dsOrder"]. Then it's running the btnSave_Click method which is trying to save a null datasession.
>>>
>>>So, what am I missing?
>>>
>>>Thanks!
>>>
>>>Eric
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform