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

Autosave form every x seconds?

7 Answers 246 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Chris May
Top achievements
Rank 1
Chris May asked on 02 Mar 2011, 06:30 PM
What I'd like to do, is asynchronously post back my form and save the data every X seconds.

I know I can do this with javascript if I iterate my controls and build up some kind of comma separated string holding all the form values and send that to the server as a page method call, but because the form is quiet complicated (nested data lists and grid views), it would be much easier if I could just write the "Save" logic 1 time in the code behind (when the user clicks "Done") and reuse that same code for the auto save.

I was thinking maybe I could somehow use the rad ajax manager to cause an async postback of the page that the user wouldn't notice, and it wouldn't update any controls.

Is this possible?

7 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 08 Mar 2011, 11:47 AM
Hi Chris,

A simple solution in this scenario would be to add an asp Timer wrapped in a RadAjaxPanel control on your page and save your data in the OnTick event of the timer. If the timer is the only control wrapped in the panel, nothing will be refreshed on your page during the callbacks that it makes.

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" >
    <asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="3000" />
</telerik:RadAjaxPanel>

Greetings,
Tsvetina
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Markus
Top achievements
Rank 1
answered on 05 Jan 2015, 05:49 PM
Hello Tsvetina

I have a similar problem. After saving the page every few minutes, the page return to the top of the page and the focus is lost from the currently editing field.
Inserting the timer alone in a separate updatePanel (PanelAutoSave, after PanelContent) didn't solve the problem.

In my scenario (Version 2013.3.1324.35  on .Net 3.5) I'm using a MasterPage. So I register the AJAX event in the ServerSide-Code of the page:
   myMaster.masterAjaxManager.AjaxSettings.AddAjaxSetting(PanelContent, PanelContent, LoadingPanel);
   myMaster.masterAjaxManager.AjaxSettings.AddAjaxSetting(Timer1, PanelAutoSave);

The page itself contains dynamically added TextBoxes and other controls (no RadEditor), all in one Panel (PanelContent)). Both panels are inside the  <asp:Content ContentPlaceHolder...></Content>.
Is the MasterPage the problem, or is it the dynamically builded Panel which is rebuild every Postback, or is there something else I'm missing?

Thanks for your suggestion
Markus
0
Maria Ilieva
Telerik team
answered on 07 Jan 2015, 07:24 AM
Hi Markus ,

Note that by default RadAjaxPanel maintains the focus of the AJAX-ified control when the response ends. Therefore instead of using RadAjaxManager to ajaxify the controls on the page please remove the RadAjaxManager and wrap the whole content in RadAjaxPanel and verify how it goes.

Regards,
Maria Ilieva
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.

 
0
Markus
Top achievements
Rank 1
answered on 12 Jan 2015, 08:38 AM
Hello Maria

Thanks for your answer.

What I now did:
I removed the registration of all controls (the two panels) on this page to the Masterpage-RadAjaxManager.
I left the timer in a separate Panel, and the dynamic controls stayed in an other Panel.
Now it works without jumping to the top of the page and it is not longer loosing the focus when a auto-save occurs.
Thanks.

Kind regards
Markus
0
Maria Ilieva
Telerik team
answered on 14 Jan 2015, 02:24 PM
Hello Markus,

Thank you for getting back to us and for providing the updates on this case.

Do not hesitate to open a new form thread or a support ticket in case further assistance is needed.

Regards,
Maria Ilieva
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.

 
0
Bhanu Prakash
Top achievements
Rank 1
answered on 01 Aug 2017, 05:04 PM

[quote]Iam developing a page where we have RadMultiPage and in one RadPageView i want autosave functionality. Can I know how can we do it.

 

Please find my code here

 

<telerik:RadPageView ID="rpvStuentInfo" runat="server">
<div class="row"></div><br /><br /><br />
<div class="large-6 columns">
<label style="font-size:20px">Your Nominations.</label>
</div>
<div class="large-6 columns" align="right">
<label>Teacher Name</label>
</div>
<div class="row">
<div class="large-6 columns">
<label>Nominate up to 10 students.</label>
</div>
<div class="large-6 columns" align="right">
<label>Teacher ID</label>
</div>

</telerik:RadPageView>

<telerik:RadPageView runat="server" ID="rpvMentorProfile">

<div class="row" id="trRbError" visible="false" runat="server">
<div class="large-12 columns">
<asp:Label ID="lblRbError" runat="server" CssClass="errorMsgText" Visible="false" Text=""></asp:Label>
</div>
</div>
<div class="row">
<div class="large-2 columns">
<%--<Label ID="lblNomrPrefix" runat="server" AssociatedControlID="cmbNomrPrefix">Prefix:<span style="color: Red">*</span></Label>--%>
<asp:DropDownList ID="cmbNomrPrefix" runat="server" DefaultMessage="Select a Prefix">
<Items>
<asp:ListItem Value="select" Text="Prefix*" />
<asp:ListItem Value="Mr." Text="Mr." />
<asp:ListItem Value="Ms." Text="Ms." />
<asp:ListItem Value="Mrs." Text="Mrs." />
<asp:ListItem Value="Miss." Text="Miss." />
<asp:ListItem Value="Dr." Text="Dr." />
<asp:ListItem Value="Sr." Text="Sr." />
<asp:ListItem Value="Prof." Text="Prof." />
<asp:ListItem Value="Other." Text="Other." />
</Items>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="rfvPreFix" ErrorMessage="Please select Prefix."
ControlToValidate="cmbNomrPrefix" runat="server" SetFocusOnError="true"
Display="None" ValidationGroup="mentordemographics" InitialValue="select" CssClass="errorMsgText" Text="*">
</asp:RequiredFieldValidator>
</div>
<%--</div>
<div class="row">--%>
<div class="large-5 columns">
<%--<Label ID="lblNomrFirstName" runat="server" AssociatedControlID="txtNomrFirstName">First Name:<span style="color: Red">*</span></Label>--%>
<telerik:RadTextBox ID="txtNomrFirstName" autocomplete="false" runat="server" Skin="" Width="100%" Text="" EmptyMessage="First Name*" ></telerik:RadTextBox>
<asp:RequiredFieldValidator ID="rfvFirstName" ErrorMessage="Enter your First Name."
ControlToValidate="txtNomrFirstName" runat="server" SetFocusOnError="true"
Display="None" ValidationGroup="mentordemographics" CssClass="errorMsgText" ShowSummary="true" Text="*">
</asp:RequiredFieldValidator>
</div>
<%-- </div>
<div class="row">--%>
<div class="large-5 columns">
<%--<Label ID="lblNomrLastName" runat="server" AssociatedControlID="txtNomrLastName">Last Name:<span style="color: Red">*</span></Label>--%>
<telerik:RadTextBox ID="txtNomrLastName" autocomplete="false" runat="server" Skin="" Width="100%" Text="" EmptyMessage="Last Name*"></telerik:RadTextBox>
<asp:RequiredFieldValidator ID="rfvLastName" ErrorMessage="Enter your Last Name."
ControlToValidate="txtNomrLastName" runat="server" SetFocusOnError="true"
Display="None" Text="*" ValidationGroup="mentordemographics" CssClass="errorMsgText">
</asp:RequiredFieldValidator>
</div>
</div>

</telerik:RadPageView>

 

[/quote]

0
Bhanu Prakash
Top achievements
Rank 1
answered on 15 Aug 2017, 03:04 AM
Can you please look in tothis
Tags
Ajax
Asked by
Chris May
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Markus
Top achievements
Rank 1
Maria Ilieva
Telerik team
Bhanu Prakash
Top achievements
Rank 1
Share this question
or