Interference with RadAsyncUpload + Validators in MultiView

4 posts, 0 answers
  1. mastermehdi
    mastermehdi avatar
    39 posts
    Member since:
    Apr 2010

    Posted 17 May 2013 Link to this post

    Hi
    HtmlChart Has a bug in this senario:
    v2013.1.417.45

    <%@ Page Language="C#" %>
     
    <!DOCTYPE html>
     
    <script runat="server">
        protected void btnDetail_Click(Object sender, EventArgs e)
        {
            double[] ValuesArray = { 26.6, 26.5, 25.8, 24.3, 24.9, 23.2, 22.0, 22.4, 22.9, 21.7, 21.2, 20.2 };
            RadHtmlChart1.DataSource = ValuesArray;
            AreaSeries area1 = new AreaSeries();
            RadHtmlChart1.PlotArea.Series.Add(area1);
            RadHtmlChart1.DataBind();
            MultiView1.SetActiveView(View2);
        }
         
        protected void btnBack_Click(Object sender, EventArgs e)
        {
            MultiView1.SetActiveView(View1);
        }
    </script>
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
            <Telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="Panel1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="Panel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </Telerik:RadAjaxManager>
            <asp:Panel ID="Panel1" runat="server">
                <asp:MultiView ID="MultiView1" runat="server"
                    ActiveViewIndex="0">
                    <asp:View ID="View1" runat="server">
                        <asp:Button ID="btnDetail" runat="server" Text="Show Details" OnClick="btnDetail_Click" />
                        <div style="display:none;">
                            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox1" runat="server" />
                            <Telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" />
                        </div>
                    </asp:View>
                    <asp:View ID="View2" runat="server">
                        <asp:Button ID="btnBack" runat="server" Text="Back" OnClick="btnBack_Click" />
                        <Telerik:RadHtmlChart ID="RadHtmlChart1" runat="server" />
                    </asp:View>
                </asp:MultiView>
            </asp:Panel>
        </form>
    </body>
    </html>

  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 22 May 2013 Link to this post

    Hello,

    I have tried to reproduce an issue related to the RadHtmlChart with the provided code sample but to no avail.

    There is, however, a special case related to the triggering of the OnClick event of the button with id="btnDetail". The textbox with id="TextBox1" is not set with any value/text and therefore the validation caused by the ASP RequiredFieldValidator fails.

    You can watch a short video with the test I have done here. If I remove the textbox and the validator the views switch and the chart on the second view is displayed properly.

     

    Regards,
    Danail Vasilev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. mastermehdi
    mastermehdi avatar
    39 posts
    Member since:
    Apr 2010

    Posted 22 May 2013 Link to this post

    Hello Danail and thanks for Reply
    but codes with your last changes, works properly for me!
    Anyway I need use all of the controls in this codes and this codes are summery of the original codes!
    when i remove one of the bottom controls, HtmlChart work fine!
    1. RequiredFieldValidator
    2. RadAsyncUpload
    3. RadAjaxManager
    or when ActiveViewIndex="1"
    I think when javascript part of RequiredFieldValidator + RadAsyncUpload + RadAjaxManager loads before HtmlChart, a javascript error occurs and prevent load HtmlChart javascript codes in second view!
    Is there a solution to this problem? (I need use all of this controls with HtmlChart)
  5. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 27 May 2013 Link to this post

    Hello,

    As I have already mentioned in my previous post, the ASP textbox with id="TextBox1" is not validated because:
    • It does not have any text set
    • And an ASP RequiredFieldValidator is used to validate it.

    Therefore the server-side event "btnDetail_Click" of the button with id="btnDetail" is not triggered which is responsible for binding the chart and setting the second view of the MultiView to be active. Removing the RadAjaxManager and RadAsyncUpload is not related to this validation.

    Therefore you can either

    • enter/set some text to the textbox with id="TextBox1" so that the validation passes and the "btnDetail_Click" method can be executed (the PageView is changed and the chart is databound and shown).
    • OR you can remove the validation, so that the "btnDetail_Click" event handler can be executed.

    Note that the usage and purpose of the ASP.NET RequiredFieldValidator control and other custom solutions is not related to the RadControls but it is a general knowledge. You can also find useful the ASP.NET RequiredFieldValidator Control help article.


    Regards,
    Danail Vasilev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top