Button remains disabled

Nov 11, 2008 at 10:20 PM

Hello. I'd really like to use this control as it seems to work well for many people. I have a Gridview inside an UpdatePanel in a collapsible panel that doesn't get populated until runtime when the user selects a value in a DDL and then clicks a button (both contained in the UpdatePanel as well). I have the ExportToExcell1 button OUTSIDE of the UpdatePanel. I tried manually setting ExportToExcell1.Enabled = true; in the Report Generation button callback (which performs the databind() on the GV) and that still will not enable it.

It seems from the discussions I need to use the PreExport="?????????" property of the ExportToExcell button but I'm not sure exactly what to fill in for the ???????. Maybe if I look at the control code I can figure it out.

The last worry is that I do have multiple GV's on my page so I am using the GridViewID property BUT I'm also using a Master Page so I'm worried the ExportToExcell button is not finding the control. I have it declared as this in my aspx content page:

            <RK:ExportToExcel ID="ExportToExcel1" runat="server" GridViewID="$get('<%= REAreaSummaryReportGV.ClientID %>')" ApplyStyleInExcel="True" Charset="utf-8"
             ContentEncoding="windows-1250" EnableHyperLinks="True" ExportFileName="FileName.xls"
             IncludeTimeStamp="True" PageSize="All" Text="Export To Excel" />

Any suggestions would be appreciated.
Thanks!






Coordinator
Nov 14, 2008 at 7:37 PM
The reason why the button is disabled is because, you might be building the grid after the "init" event of the export to excel control fires. What you can do is, after you build the grid, you can manually set the "Enabled" property to "true". Will that work for you?

-Regards
Nov 14, 2008 at 8:32 PM
Hi Rajesh-

As I stated in my post I tried to set Enabled=true after the DataBind() w/o any luck. I was wondering if you could explain exactly what value should be placed in the PreExport="" property?

Much appreciated!!
-ryan
Coordinator
Nov 14, 2008 at 10:59 PM
PreExport is an event of "Export to Excel" button control.  If you are building your grid at runtime, you might want to rebuild your grid in this event so that Data is available during export.

Let me know how it goes.
Nov 14, 2008 at 11:22 PM
So PreExport="SomeFunctionToBeCalledWhichDatabindsTheGridview"

protected void SomeFunctionToBeCalledWhichDatabindsTheGridview()
{
    GV.DataBind();
}

If so, how do I know this event will be triggered when I have data to be bound to the GV and not before?
thanks!-ryan