We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Performing a postback to a different .aspx page.

Hello,

Is it possible to perform a Response.Redirect() on an ej-button click event within a tab to another page? I am using Ajax to load external aspx pages so users can edit a specific element (in tabs) then click a save button. However, when a click occurs, the postback is to the tab's url. 

Any insight would be fantastic.

Thank you!

3 Replies

AB Ashokkumar Balasubramanian Syncfusion Team August 28, 2019 12:46 AM

Hi Matt,  
 
Good day to you. 
 
Yes, you can perform a Response.Redirect on ejButton click. We have rendered a button with “button” type inside Tab and redirected to another aspx page through server side click event. Please refer to the following code 
 
<ej:Tab ID="tabButton" runat="server"> 
    <Items> 
        <ej:TabItem ID="button" Text="Button"> 
            <ContentSection> 
                <ej:Button ID="redirect" Type="Button" Text="Redirect" OnClick="Redirect_Click" runat="server"></ej:Button> 
            </ContentSection> 
        </ej:TabItem> 
        .  . . . . 
    </Items> 
</ej:Tab> 
 
Aspx.cs: 
protected void Redirect_Click(object Sender, Syncfusion.JavaScript.Web.ButtonEventArgs e) 
        { 
            Response.Redirect("~/Default.aspx", true); 
        } 
 
Sample can be downloaded from the following link 
 
 
Kindly check the provided sample and revert us, if you need any further assistance. 
 
Regards, 
Ashokkumar B. 



MB Matt Broich August 29, 2019 07:29 AM

Hi Ashokkumar,

Sadly this did not work. 

Let me clarify:

Here is my tab markup: 
               <ej:Tab ID="Tab" runat="server" EnableTabScroll="true" Width="100%" Height="900px" HeightAdjustMode="Content"></ej:Tab>
Here is the code behind: 

                foreach (var pageItem in pageItems)
                {
                    string url = String.Format("{0}?pkid={1}&siteid={2}", pageItem.AbsoluteUrl, ViewState["pkid"].ToString(), ViewState["siteid"].ToString());
                    Tab.Items.Add(new Syncfusion.JavaScript.Web.TabItem { Text = pageItem.Name, Url = url });
                }

Each tab is dynamically created from our database. However, since these pages are being loaded in through AJAX, I have no control over the postback url. Whenever I click a save/update button in a tab, the page reloads specifically to that tab's content. Instead of the Response.Redirect navigating me back to the page containing the tabs, it navigates me to the tab's url. I have made a workaround using an AJAX POST call in the .aspx page, however, I would much rather use the code behind to store my server code. 

Thank you!


AB Ashokkumar Balasubramanian Syncfusion Team August 30, 2019 01:24 AM

Hi Matt, 
 
We have included a tab item dynamically during page load. Redirect action works fine in our end. Please refer to the below sample and video links 
 
 
 
Also, we are not clear about where the tab items are added dynamically. Initially at page load? or during some AJAX action? If it is added during page load, then IsPostBack condition should be checked there. Please check the above sample and if issue persists, kindly modify the above sample based on your code else share us your complete code snippet along with a video (if possible) so that we can proceed further. 
 
Regards, 
Ashokkumar B. 


Loader.
Live Chat Icon For mobile
Up arrow icon