Server-side PostBack in RadAjaxManager UpdatedControls

3 posts, 1 answers
  1. T
    T avatar
    4 posts
    Member since:
    Nov 2008

    Posted 07 Sep 2010 Link to this post

    Hi,

    I've got a FormView (insert mode only) with an ObjectDataSource. I want to split the FormView into several "pages", controlled by a RadTabStrip (hiding panels, showing selected panel). Works perfectly! In the last panel I want to show the submit button for the FormView. The submit button should be not ajaxified doing a server postback.

    How do I do a server-side postback inside an updated control?
    Did I understand the concept of the RadAjaxManager right?

    Thanks,
    Toby

    relevant code (ASPX):
    <!-- form view --->
               <asp:FormView ID="QuestionnaireFormView" runat="server"  
                    DataSourceID="QuestionnaireObjectDataSource" DefaultMode="Insert"
                    DataKeyNames="Id">
                    <InsertItemTemplate>
                    <asp:Panel ID="Panel1" runat="server" CssClass="questionnairepanel">
                     [...]
                    </asp:Panel>
                    <asp:Panel ID="Panel2" runat="server" CssClass="questionnairepanel">
                     [...]
                    </asp:Panel>
                    </InsertItemTemplate>
                </asp:FormView>

    <!-- submit button --->
                <div id="div_insertbutton" runat="server" class="div_buttons">
                    <asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" AlternateText="Submit" Text=Submit" CssClass="submitbutton" />
                </div>

    <!-- tab strip --->
    <telerik:RadTabStrip ID="RadTabStripQuestionnaire" runat="server" CssClass="rctabstrip"  
                        ontabclick="RadTabStripQuestionnaire_TabClick" AutoPostBack="True"
                        SelectedIndex="1">
                        <Tabs>
                            <telerik:RadTab runat="server" Text="Question 1-3"  Value="1" CssClass="rctab" SelectedCssClass="rctab_selected" Selected="True">
                            </telerik:RadTab>
                            <telerik:RadTab runat="server" Text="Question 4-8" Value="2" CssClass="rctab" SelectedCssClass="rctab_selected">
                            </telerik:RadTab>
                            [...]
                        </Tabs>
    </telerik:RadTabStrip>

    <!-- ajax manager --->
        <telerik:RadAjaxManager runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadTabStripQuestionnaire">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStripQuestionnaire" />
                        <telerik:AjaxUpdatedControl ControlID="div_insertbutton" />
                        <telerik:AjaxUpdatedControl ControlID="Panel1" />
                        <telerik:AjaxUpdatedControl ControlID="Panel2" />
                         [...]
                     </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

    relevant code (CS):
            protected void RadTabStripQuestionnaire_TabClick(object sender, Telerik.Web.UI.RadTabStripEventArgs e)
            {
                currentpanel = e.Tab.Value;
                HideShowPanels(currentpanel);
            }

            private void HideShowPanels(string currentpanel)
            {
                [...]
                // in last panel show submit button
                div_insertbutton.Visible = true;
            }


  2. Answer
    Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 07 Sep 2010 Link to this post

    Hi,

    You need to handle the RadAjaxManager OnRequestStart client-side event and there disable ajax in case the submit button is clicked. You can find the above solution described in section 1. (Disable ajax in the OnRequestStart client-side event handler of the RadAjaxManager control for the particular postback) of this help topic.

    Sincerely yours,
    Iana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. T
    T avatar
    4 posts
    Member since:
    Nov 2008

    Posted 07 Sep 2010 Link to this post

    Hi Iana,

    thanks! That did the trick!

    Went for solution 2 of the help topic...

    Toby
Back to Top