RadTabStrip inside FormView

3 posts, 0 answers
  1. Leoš
    Leoš avatar
    3 posts
    Member since:
    Aug 2011

    Posted 01 Aug 2011 Link to this post

    Hello,

    I've noticed a buggy behaviour using Telerik RadTabStrip inside ASP.NET FormView. First of all, I tried to create an example without FormView and everything worked fine. Then I put RadTabStrip and RadMultiPage inside EditItemTemplate of FormView and a problem occured.

    I have 3 tabs, and when I set one of them Visible to false in Page.PreRender event, for the first time, the tab is not rendered. But after postback, even though the value is correctly loaded from viewstate and the Visible property is false (according to debugger), the tab is unexpectably rendered.

    Here is the code:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestTabStrip.Default" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <asp:FormView ID="fvSystemConfig" DefaultMode="Edit" DataSourceID="odsDS" RenderOuterTable="false" runat="server">
                <EditItemTemplate>
                    <telerik:RadTabStrip ID="rts" runat="server" MultiPageID="rmp">
                        <Tabs>
                            <telerik:RadTab Text="Core" PageViewID="rpv1" />
                            <telerik:RadTab Text="UI" PageViewID="rpv2" />
                            <telerik:RadTab Text="Export" PageViewID="rpv3" />
                        </Tabs>
                    </telerik:RadTabStrip>
                    <telerik:RadMultiPage ID="rmp" SelectedIndex="0" CssClass="RadTabStripMultipage" runat="server">
                        <telerik:RadPageView ID="rpv1" runat="server">
                            <asp:TextBox ID="tb" Text='<%# Bind("Name") %>' runat="server" />
                        </telerik:RadPageView>
                        <telerik:RadPageView ID="rpv2" runat="server">
                            B
                        </telerik:RadPageView>
                        <telerik:RadPageView ID="rpv3" runat="server">
                            C
                        </telerik:RadPageView>
                    </telerik:RadMultiPage>
                    <asp:Button ID="Button1" CommandName="Update" Text="Save" runat="server" />
                </EditItemTemplate>
            </asp:FormView>
            <asp:ObjectDataSource ID="odsDS" runat="server" SelectMethod="GetData" TypeName="TestTabStrip.Default" UpdateMethod="UpdateData" />
        </div>
        </form>
    </body>
    </html>

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
    using System.Collections;
     
    namespace TestTabStrip
    {
        public partial class Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
     
            }
     
            protected override void OnPreRender(EventArgs e)
            {
                ((RadTabStrip)fvSystemConfig.Row.FindControl("rts")).Tabs[1].Visible = false;
                base.OnPreRender(e);
            }
     
            public IEnumerable GetData()
            {
                return new List<object> { new { Name = "testing text" } };
            }
     
            public void UpdateData(string name)
            {
            }
        }
    }

    The version that I am using is 2010 Q3. Please let me know, if the bug has been repaired in the newer version, but in the very moment, I cannot test it in newer one.

    Thank you for your response.

    Best regards,
        Leoš
  2. Leoš
    Leoš avatar
    3 posts
    Member since:
    Aug 2011

    Posted 03 Aug 2011 Link to this post

    Hi,

    I have just tested it in 2011 Q2 and it's not working either.

    Best regards,
        Leoš
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Leoš
    Leoš avatar
    3 posts
    Member since:
    Aug 2011

    Posted 04 Aug 2011 Link to this post

    Hi again,

    I found, that this is general problem, which can be applied to every web-control placed inside EditItemTemplate. After Update, there is an additional DataBind, which is performed just after OnPreRender of the page and before PreRender of the FormView. So the visibility setting must be done within the PreRender event of the FormView (after that additional DataBind), and it's all right.

    RESOLVED.
Back to Top