This is a migrated thread and some comments may be shown as answers.

Export button within ASP .NET user control causing full postback?

3 Answers 162 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 15 Apr 2014, 04:18 PM
Hello, I have a RadButton which lives on a user control, which in turn is within a master page.

I'm trying to use the RegisterPostBackControl method of the master page's RadScriptManager object to register the button, but upon clicking it still is causing a FULL postback rather than executing the button's OnClick which references a separate ExportToExcel method I've created.

I have the Page_Load in the user control below as follows, what am I doing wrong?

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                ((RadScriptManager)Page.Master.FindControl("RadScriptManager1")).RegisterPostBackControl(_ExportButton);
            }
        }



Here is the markup for the RadButton:

      <telerik:RadButton runat="server" ID="_ExportButton" Text="Export" Enabled="False" AutoPostBack="True" OnClick="ExportToExcelClick"  />
    

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Apr 2014, 04:56 AM
Hello,

Add below method in RadAjaxmanager/RadAjaxpanel.

ClientEvents-OnRequestStart="onRequestStart"

JS Code

<script type="text/javascript">
       function onRequestStart(sender, args)
       {
           if (args.get_eventTarget().indexOf("ExportButton") >= 0)
           {
               args.set_enableAjax(false);
           }
       }
   </script>

...............

If you used UpdatePanel then

ScriptManager1.RegisterPostBackControl(_ExportButton);

For more information please check below link.
Export from Ajaxified Grid

Let me know if any concern.

Thanks,
Jayesh Goyani
0
Alan
Top achievements
Rank 1
answered on 16 Apr 2014, 03:27 PM
Thanks for your reply, Jayesh!

I tried implementing this as you suggested and it works great, but to give more detail, the Export button lives within in a RadToolTip control, which itself lives within another user control.

It seems like the RadToolTip does not "survive" the full postback (which kind of makes sense, when a page loads fresh you wouldn't expect a tooltip to persist), so maybe this scenario isn't feasible for an export button within a RadToolTip control?

Anyway thanks for the help, I may fall back and use a different method. If you have any ideas though please post.
0
Eyup
Telerik team
answered on 21 Apr 2014, 07:48 AM
Hi Alan,

Generally, you can persist the state of the ToolTip by manually implementing a save/load logic. In case you have difficulties achieving it, please elaborate on your specific scenario and send us sample screenshots or video demonstrating the desired behavior. Thus, we will be able to prepare a sample web site and send it to you.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Alan
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Alan
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or