CodeSmith Community
Your Code. Your Way. Faster!

Export to Excel Exception

Latest post 03-04-2008 10:11 AM by rkralston. 2 replies.
  • 02-28-2008 12:34 PM

    Export to Excel Exception

    I am running the canned Admin forms for a simple database.  I found where to turn Excel export on in the GridViews.  I have included the registerPostBack code listed elswhere and am executing this on the GridView's preRender Event.  However, I am still blowing up in EntityGridView.Export on line 919, htmlForm.RenderControl(htmlWriter) with RegisterForEventValidation can only be called during Render().

     I appreciate any help.

    • Post Points: 35
  • 03-04-2008 10:00 AM In reply to

    • CitizenBane
    • Top 50 Contributor
    • Joined on 10-30-2007
    • Grand Rapids, MI
    • Posts 94
    • Points 1,740

    Re: Export to Excel Exception

    This works for me... or is this what you used? 

     

        /// <summary>
        /// Fixes AJAX error when you click "Export to Excel" after you've made a previous AJAX callback
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void egv1_OnPreRender(object sender, EventArgs e)
        {
             registerPostBack();
        }

        private void registerPostBack()
        {
            System.Collections.Generic.IList<Control> list = FormUtil.FindControls(EntityGridView1, "lnkExport");

            if (list.Count > 0)
            {
                LinkButton lnkExport = list[0] as LinkButton;
                ScriptManager sm = ScriptManager.GetCurrent(this.Page);
                if (sm != null)
                    sm.RegisterPostBackControl(lnkExport);
            }
        }

    I'm outside ur box, shiftin' ur paradigm.
    • Post Points: 35
  • 03-04-2008 10:11 AM In reply to

    RE: Export to Excel Exception

    This is what I tried.

     

    I’ll need to have another look.  I believeI wired it into these events.

     


    From: CitizenBane[mailto:bounce-CitizenBane@codesmithsupport.com]
    Sent: Tuesday, March 04, 200810:05 AM
    To: rkralston@gmail.com
    Subject: Re: [.netTiers GeneralSupport] Export to Excel Exception

     

    Thisworks for me... or is this what you used? 

     

       /// <summary>
        /// Fixes AJAX error when youclick "Export to Excel" after you've made a previous AJAX callback
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void egv1_OnPreRender(object sender, EventArgs e)
        {
             registerPostBack();
        }

       private void registerPostBack()
        {
           System.Collections.Generic.IList<Control> list =FormUtil.FindControls(EntityGridView1, "lnkExport");

           if (list.Count > 0)
            {
                LinkButton lnkExport = list[0] as LinkButton;
                ScriptManager sm = ScriptManager.GetCurrent(this.Page);
                if (sm != null)
                    sm.RegisterPostBackControl(lnkExport);
            }
        }



    • Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems