This is a migrated thread and some comments may be shown as answers.

RadNumericTextBox validation not working with RadAjaxManager

5 Answers 106 Views
Input
This is a migrated thread and some comments may be shown as answers.
ric c
Top achievements
Rank 1
ric c asked on 28 Sep 2011, 12:16 PM
Hi,
I have a RadNumericTextBox within an <asp:PlaceHolder>

On page load the <asp:PlaceHolder is not visible. After a series of drop downs within another <asp:PlaceHolder the last drop down set the visibility of the place holder that contains my RadNumericTextBox to true.

this is my RadAjaxManager
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="PhChoice">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="PhWithTb" />
            </UpdatedControls>
        </telerik:AjaxSetting>

When I run this the PnWithTb shows but the validation on the RadNumericTextBox does not work. If I set EnableAjax=False on the RadAjaxManager to false it works fine. 

Can any one suggest what I'm doing wrong?

Thanks

5 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 28 Sep 2011, 12:50 PM
Hello Ric C,

I tested the code-below in our latest release and it is working as expected. Please confirm that you use Q2 2011 SP1 (2011.2.915) version?

Aspx:
<telerik:RadAjaxManager ID="ajaxManager" runat="server">
  <AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="Button1">
      <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="PlaceHolder1" />
      </UpdatedControls>
    </telerik:AjaxSetting>
  </AjaxSettings>
</telerik:RadAjaxManager>
<asp:PlaceHolder runat="server" ID="PlaceHolder1" Visible="false">
  <telerik:RadNumericTextBox runat="server" ID="RadNumericTextBox1" />
  <asp:Button ID="Button1" Text="submit" runat="server" />
  <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="RadNumericTextBox1"
    ErrorMessage="Required"></asp:RequiredFieldValidator>
</asp:PlaceHolder>
<asp:Button runat="server" ID="Button2" OnClick="Button1_Click" Text="Click to show the PlaceHolder" />
C#:
protected void Button1_Click(object sender, EventArgs e)
{
    PlaceHolder1.Visible = true;
}

Greetings,
Vasil
the Telerik team
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
0
ric c
Top achievements
Rank 1
answered on 29 Sep 2011, 09:11 AM

Hi, Thanks for the quick reply!

Yes your example works (I'm using v.2010.1.309.20), however its not quite what I was looking for. I've updated your code as below. Now the validation is not working on the RadNumericTextBox, any ideas? Thanks!

<telerik:RadAjaxManager ID="ajaxManager" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="Button2">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="PlaceHolder1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="Button1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="PlaceHolder1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
0
Vasil
Telerik team
answered on 29 Sep 2011, 11:18 AM
Hi Ric C,

I tested with modified version that you provided and I can confirm it is working correctly with the latest version of the controls. I would suggest yo to upgrade in order to resolve this issue.

Kind regards,
Vasil
the Telerik team
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
0
ric c
Top achievements
Rank 1
answered on 03 Oct 2011, 11:29 AM
Hi Thanks for the reply.

I was using an old version. I have just downloaded the latest version (demo) to test before purchase, however I am having the same problem with the latest release. If I disable ajax it works fine.

This is the code:
aspx:
 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RadTest1._Default" %>
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!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>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
                </asp:ScriptReference>
            </Scripts>
        </telerik:RadScriptManager>
        <asp:PlaceHolder ID="PhLoader" runat="server"></asp:PlaceHolder>
    </div>
    </form>
</body>
</html>
aspx.cs
protected void Page_Load(object sender, EventArgs e)
        {
            Control c = LoadControl("WebUserControl1.ascx");
            PhLoader.Controls.Add(c);
        }

ascx:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadAjaxManager ID="ajaxManager" runat="server" EnableAJAX="true">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="Button2">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="PlaceHolder1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="Button1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="PlaceHolder1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
[<asp:Literal ID="LitMsg" runat="server"></asp:Literal>]
<asp:PlaceHolder runat="server" ID="PlaceHolder1" Visible="false">
    <telerik:RadNumericTextBox runat="server" ID="RadNumericTextBox1"  />
    <asp:Button ID="Button1" Text="submit" runat="server" />
    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="RadNumericTextBox1"
        ErrorMessage="Required"></asp:RequiredFieldValidator>
</asp:PlaceHolder>
<asp:Button runat="server" ID="Button2" OnClick="Button1_Click" Text="Click to show the PlaceHolder" />
ascx.cs
protected void Page_Load(object sender, EventArgs e)
        {
            LitMsg.Text = DateTime.Now.ToLongTimeString();
        }
  
        protected void Button1_Click(object sender, EventArgs e)
        {
            PlaceHolder1.Visible = true;
        }
0
Vasil
Telerik team
answered on 04 Oct 2011, 09:28 AM
Hi Ric C,

In your code WebUserControl is loaded too late and this is causing the problem. Should load the control on Page_Init instead of Page_Load.

protected void Page_Init(object sender, EventArgs e)
{
    Control c = LoadControl("WebUserControl1.ascx");
    PhLoader.Controls.Add(c);
}
For your convenience I am attaching modified version of the web site that is working on my end.

Regards,
Vasil
the Telerik team
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
Tags
Input
Asked by
ric c
Top achievements
Rank 1
Answers by
Vasil
Telerik team
ric c
Top achievements
Rank 1
Share this question
or