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

RadAjaxManager causes all controls in panel to be updated

1 Answer 70 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 29 Jan 2009, 06:07 PM
I am using ASP.NET for AJAX Quarter 3 2008 and am having an issue with the RadAjaxManager.

I have an asp:Panel that needs to be shown and hidden during different parts of a registration process.  Inside the panel I have 3 drop down lists to select a date that use AJAX to build the days drop down when the month or year dropdown changes.
I also have a password textbox inside the panel.
I have an asp:Button that works as a next button to hide the panel and show the next panel.

The problem is that since the panel is an updatable control for the next button, all of it's contained controls are also updatable.  When the dropdown onchange event is fired, the AJAX works correctly, but since all controls are now updatable I lose the value in my password textbox since that value is not stored in viewstate.  I can also set the value of any control inside the panel.

RadAjaxManager did not used to work like this.

Is there any way to force controls inside of a panel that is set as an updatable control to not also be updatable controls?

Here is a trimmed down sample of the problem.

ASPX Page
<asp:Panel ID="AJAXpnlRegistrationInfo2" runat="server">  
    <asp:Panel ID="pnlRegistrationInfo2" runat="server" DefaultButton="btnRegisterNext" ToolTip="Registration Form">  
        <asp:TextBox ID="txtPassword1" runat="server" TextMode="password" Width="94"></asp:TextBox> 
        <asp:TextBox ID="txtAddress1" runat="server" Width="94"></asp:TextBox> 
        <asp:DropDownList ID="ddlBirthMonth" runat="server" AutoPostBack="true">  
        <asp:ListItem Value="" Text=""></asp:ListItem> 
        <asp:ListItem Value="1" Text="Jan"></asp:ListItem> 
        <asp:ListItem Value="2" Text="Feb"></asp:ListItem> 
        <asp:ListItem Value="3" Text="Mar"></asp:ListItem> 
        <asp:ListItem Value="4" Text="Apr"></asp:ListItem> 
        <asp:ListItem Value="5" Text="May"></asp:ListItem> 
        <asp:ListItem Value="6" Text="Jun"></asp:ListItem> 
        <asp:ListItem Value="7" Text="Jul"></asp:ListItem> 
        <asp:ListItem Value="8" Text="Aug"></asp:ListItem> 
        <asp:ListItem Value="9" Text="Sep"></asp:ListItem> 
        <asp:ListItem Value="10" Text="Oct"></asp:ListItem> 
        <asp:ListItem Value="11" Text="Nov"></asp:ListItem> 
        <asp:ListItem Value="12" Text="Dec"></asp:ListItem> 
        </asp:DropDownList> 
        <asp:DropDownList ID="ddlBirthDay" runat="server" AppendDataBoundItems="true">  
        <asp:ListItem Value="" Text=""></asp:ListItem> 
        </asp:DropDownList> 
        <asp:DropDownList ID="ddlBirthYear" runat="server" AutoPostBack="true" AppendDataBoundItems="true">  
        <asp:ListItem Value="" Text=""></asp:ListItem> 
        </asp:DropDownList> 
    </asp:Panel> 
    <asp:Panel ID="pnlRegButtons" runat="server" CssClass="registrationNav">  
        <asp:ImageButton ID="btnRegisterNext" runat="server" SkinID="GreenContinueButton" /> 
    </asp:Panel> 
</asp:Panel> 

CodeBehind
    protected void Page_Load(object sender, EventArgs e)  
    {  
            btnRegisterNext.Click += new ImageClickEventHandler(btnRegisterNext_Click);  
            ddlBirthMonth.SelectedIndexChanged += new EventHandler(ddlBirthMonth_SelectedIndexChanged);  
            ddlBirthYear.SelectedIndexChanged += new EventHandler(ddlBirthMonth_SelectedIndexChanged);  
      
        radManager.AjaxSettings.AddAjaxSetting(btnRegisterNext, AJAXpnlRegistrationInfo2);  
        radManager.AjaxSettings.AddAjaxSetting(btnRegisterNext, pnlRegistrationInfo2);  
        radManager.AjaxSettings.AddAjaxSetting(ddlBirthMonth, ddlBirthDay);  
        radManager.AjaxSettings.AddAjaxSetting(ddlBirthYear, ddlBirthDay);  
    }  
          
    void btnRegisterNext_Click(object sender, ImageClickEventArgs e)  
    {  
        pnlRegistrationInfo2.Visible = false;  
    }  
      
    void ddlBirthMonth_SelectedIndexChanged(object sender, EventArgs e)  
    {  
        txtAddress1.Text = "Shouldn't be able to set this.";  
        //populate other dates  
    } 

Thanks for your time.

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 02 Feb 2009, 03:20 PM
Hi Tom,

RadAjax for ASP.NET AJAX is built on top of MS Ajax Framework. And RadAjaxManager dynamically adds UpdatePanels around the updated via ajax controls. Thus once updated, your Panel is wrapped by UpdatePanel and that is why it starts performing callbacks instead of postbacks.

Additionally, could you confirm that after disabling ajax the issue with the password textbox does not persist?

I hope this helps. 

All the best,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Tom
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or