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

Validation in hidden panel not working in masterpage scenario

2 Answers 90 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
cglubish
Top achievements
Rank 2
cglubish asked on 08 Dec 2010, 05:01 PM
Hi,

I am trying to get the following scenario working:

Masterpage (containing radajaxmanager) > ContentPage
ContentPage contains 2 divs wrapped in an ajaxified wrapper.  First div has a linkbutton that reveals the second div.  Second div contains a required field validator.

The initially hidden validator doesn't work (using display:none; not visible=false).

If I take this exact scenario and remove the masterpage, it works fine.

For example - this DOES WORK
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2_nomaster.aspx.cs" Inherits="_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">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />
   
  <div runat="server" id="ajaxWrapper">
     
    <div runat="server" ID="pn0">
        <asp:LinkButton runat="server" ID="lb1" OnClick="nextClick1">Go</asp:LinkButton>   
    </div>
 
    <div runat="server" id="pn1" style="display:none;">
 
       Required field with required validator
       <asp:RequiredFieldValidator runat="server" ErrorMessage="*" ID="req1" ControlToValidate="tb1" ValidationGroup="formGroup1" />
       <asp:TextBox runat="server" ID="tb1" />
         
       <asp:LinkButton runat="server" ID="lb2" OnClick="nextClick2" CausesValidation="true" ValidationGroup="formGroup1">Next</asp:LinkButton>
   
    </div>
 
    <div runat="server" ID="pn2" style="display:none;">
        Validation passed
    </div>
 
</div>
 
____
 
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(ajaxWrapper, ajaxWrapper);
    }
 
    protected void nextClick1(object sender, EventArgs e)
    {
        pn0.Style["Display"] = "none";
        pn1.Style["Display"] = "block";
    }
 
    protected void nextClick2(object sender, EventArgs e)
    {
        pn1.Style["Display"] = "none";
        pn2.Style["Display"] = "block";
    }
}

This doesn't
<%@ Page Title="" Language="C#" MasterPageFile="~/test.master" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="myPage" %>
<%@ MasterType VirtualPath="~/test.master" %>
 
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
 
<div runat="server" id="ajaxWrapper">
     
    <div runat="server" ID="pn0">
        <asp:LinkButton runat="server" ID="LB1" OnClick="nextClick1">Go</asp:LinkButton>   
    </div>
 
    <div runat="server" id="pn1" style="display:none;">
 
       Required field with required validator
       <asp:RequiredFieldValidator runat="server" ErrorMessage="*" ID="req1" ControlToValidate="tb1" ValidationGroup="formGroup1" />
       <asp:TextBox runat="server" ID="tb1" />
         
       <asp:LinkButton runat="server" ID="LB2" OnClick="nextClick2" CausesValidation="true" ValidationGroup="formGroup1">Next</asp:LinkButton>
   
    </div>
 
    <div runat="server" ID="pn2" style="display:none;">
        Validation passed
    </div>
 
</div>
 
</asp:Content>
 
______
 
public partial class myPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RadAjaxManager myAjaxMgr = (RadAjaxManager)this.Page.Master.FindControl("RadAjaxManager1");
        myAjaxMgr.AjaxSettings.AddAjaxSetting(ajaxWrapper, ajaxWrapper);
    }
 
    protected void nextClick1(object sender, EventArgs e)
    {
        pn0.Style["Display"] = "none";
        pn1.Style["Display"] = "block";
    }
 
    protected void nextClick2(object sender, EventArgs e)
    {
        pn1.Style["Display"] = "none";
        pn2.Style["Display"] = "block";
    }
}

2 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 14 Dec 2010, 10:11 AM
Hello Mr,

I added the provided code to a runnable web site attached to this post.
It works fine on my end. Can you try it out and let me know if I missed something out?

All the best,
Iana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
cglubish
Top achievements
Rank 2
answered on 14 Dec 2010, 02:16 PM
I have resolved this by upgrading to your latest version.  I changed nothing else in my code but it works fine now. 

But FYI or perhaps someone else has a similar issue:

Our environment was IIS 7 (integrated pipeline) using version 2009.3.1314.20
If I got rid of Teleirik and used a plain updatepanel it worked.
Upgraded to version 2010.3.1109.40 - now it works fine... not sure why but I'm happy

cheers
Tags
Ajax
Asked by
cglubish
Top achievements
Rank 2
Answers by
Iana Tsolova
Telerik team
cglubish
Top achievements
Rank 2
Share this question
or