How to reload each tab in one page

Hello,

I have a question about ej:tab.  I'm working on multiple tab which has user control.
I want to reload content in each tab not all tabs when tab is clicked.
Is it possible to do that?


I don't want to use ShowReloadIcon property.  When click event happens, I just want to reload only each tab.

For example, if I click Second Data Tab, I just want to reload ucSecond control.

Thanks,
Yukiko

Attachment: Tab_21ac776d.7z

5 Replies

KV Karthikeyan Viswanathan Syncfusion Team September 21, 2018 10:43 AM UTC

Hi Yukiko, 
 
Based on your requirement, you can refresh the tab content by using ajax . 
 
In Ajax success event, you can load the content into tab based on active index in before active event. 

Please refer the below code example: 

<Code> 
<ej:Tab ID="MemberViewTab" runat="server" Width="785px" ClientSideOnBeforeActive="onBefore" > 
 
                   <Items> 
                        <ej:TabItem Id="PersonalDataTab" Text="Personal Data" > 
                                <ContentSection> 
                                          <uc1:ucperson ID="ucPerson1" runat="server" /> 
                                 </ContentSection> 
                        </ej:TabItem> 
                          <ej:TabItem Id="SecondTab" Text="Second Data" > 
                                <ContentSection> 
                                    <ucS:ucSecond ID="ucSecond1" runat="server" /> 
                                 </ContentSection> 
                        </ej:TabItem> 
 
                   </Items> 
            </ej:Tab> 
 
        </div> 
        
    </div> 
 
    <script type="text/javascript"> 
 
        function onBefore(args) { 
            $(this.contentPanels[args.activeIndex]).load("ucSecond.ascx"); 
        } 
    </script> 


</code> 


Regards, 
Karthikeyan V. 



YI Yukiko Imazu September 24, 2018 02:06 PM UTC

Hi,

I tried solution that you mentioned above, but it seems like not loaded correctly.
What I want to do is
 1. During second tab is active, the data of grid in first tab is changed by someone. (changing data in database by manually) 
 2. when switch to first tab active, grid should be latest data.  (which means loading new data)

When I do this operation, it seems like not updated data on tab.

Is it possible to this with syncfusion tab?

Thanks,
Yukiko




KV Karthikeyan Viswanathan Syncfusion Team September 25, 2018 09:08 AM UTC

Hi Yukiko,  
 
According to your query, you need to refresh the data of the Grid in the tab when the respective Tab is active. To achieve your requirement we suggest you to bind the server side event OnTabItemActive event to the tab control. Due to which server side post is sent and the grid model is updated in the postback which reflects the changes made in the database. Also to avoid the full page refresh for the OnTabItemActive event we suggest you to place the tab control inside an Update panel.  
 
Please refer the below code example.  
 
<div class="jumbotron">  
        
      <ej:DropDownList ID="dp1" runat="server" ClientSideOnChange="change"DataTextField="Text" DataValueField="Value" />  
    </div>  
  
    <div class="row">  
        <div class="col-md-12">  
              
    <asp:UpdatePanel runat="server">  
       <ContentTemplate>  
  
            <ej:Tab ID="MemberViewTab" runat="server" Width="785px" OnTabItemActive="TabItemActive" >  
  
                   <Items>  
                        <ej:TabItem Id="PersonalDataTab" Text="Personal Data"  >  
                                <ContentSection>  
                                          <uc1:ucperson ID="ucPerson1" runat="server" />  
                                 </ContentSection>  
                        </ej:TabItem>  
                          <ej:TabItem Id="SecondTab" Text="Second Data" >  
                                <ContentSection>  
                                    <ucS:ucSecond ID="ucSecond1" runat="server" />  
                                 </ContentSection>  
                        </ej:TabItem>  
  
                   </Items>  
            </ej:Tab>  
  
    </ContentTemplate>  
  </asp:UpdatePanel>  
  
        </div>  
         
    </div>   
 
[Default.aspx.vb]  
 
Protected Sub TabItemActive(ByVal sender As Object, ByVal e AsSyncfusion.JavaScript.Web.TabEventArgs) Handles MemberViewTab.TabItemActive  
        'required code  
    End Sub  
 
We have modified the provided sample with the mentioned changes. Please refer the below link for the sample.  
 
 
Regards,  
Karthikeyan V. 



YI Yukiko Imazu September 26, 2018 07:18 PM UTC

Hi Karthikeyan,

Thank you for your support and sample.

Regards,
Yukiko




KV Karthikeyan Viswanathan Syncfusion Team September 27, 2018 04:44 AM UTC

Hi Yukiko, 
 
Thanks for the update. 
 
We glad to hear that your issue has been resolved. 
 
Regards, 
Karthikeyan V. 


Loader.
Up arrow icon