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

AjaxManagerUpdated Controls become ajaxified

1 Answer 62 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
tom
Top achievements
Rank 1
tom asked on 24 Mar 2009, 05:16 PM
I seem to have run into an issue that I don't seem to be able to resolve (without some nice javascript). I am using the 2008.03.1105.35 release of the asp.net ajax controls and seem to have the following issue with the rad ajax manager.

The aspx
<div style="margin-left:50px; margin-top:50px;"
    <ul style="list-style-type:none; line-height:50px;"
        <li> 
            <telerik:RadComboBox ID="rcbSelection" runat="server" AutoPostBack="true"
                <Items> 
                    <telerik:RadComboBoxItem Text="Show Button" Value="sb" /> 
                    <telerik:RadComboBoxItem Text="Hide Button" Value="hb" /> 
                </Items> 
            </telerik:RadComboBox> 
        </li> 
        <li> 
            <asp:Label ID="lblButtonStatus" runat="server" Text="The Button that should post back is now visible." /> 
        </li> 
        <li> 
            <div style="width:500px; overflow:auto; border: solid 1px black;"
                <asp:Label ID="lblChangingText" runat="server" Text="This Text should Change" /> 
            </div> 
        </li> 
        <li> 
            <div> 
                <asp:Button ID="btnPostBackButton" runat="server" Text="Post Back Button" /> 
                <asp:Button ID="btnShouldDoAFullPostBack" runat="server" Text="Should Do A Full PostBack" /> 
            </div> 
        </li> 
    </ul> 
</div> 
         
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="rcbSelection" EventName="SelectedIndexChanged"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="lblButtonStatus" /> 
                <telerik:AjaxUpdatedControl ControlID="btnShouldDoAFullPostBack" /> 
                <telerik:AjaxUpdatedControl ControlID="lblChangingText" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 

The code behind

protected void Page_Load(object sender, EventArgs e) 
 
 
protected override void OnInit(EventArgs e) 
    base.OnInit(e); 
 
    this.rcbSelection.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(rcbSelection_SelectedIndexChanged); 
 
    this.btnShouldDoAFullPostBack.Click += new EventHandler(btnShouldDoAFullPostBack_Click); 
    this.btnPostBackButton.Click += new EventHandler(btnPostBackButton_Click); 
 
void rcbSelection_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) 
    switch(e.Value.ToString().ToLower()) 
    { 
        case "sb"
            lblButtonStatus.Text = "The Button that should post back is now visible."
            btnShouldDoAFullPostBack.Visible = true
            break
 
        case "hb"
            lblButtonStatus.Text = "The Button that should post back is no longer visible."
            btnShouldDoAFullPostBack.Visible = false
            break
    } 
 
void btnPostBackButton_Click(object sender, EventArgs e) 
    lblChangingText.Text = "You did a correct, full post back"
    lblChangingText.ForeColor = System.Drawing.Color.Black; 
 
void btnShouldDoAFullPostBack_Click(object sender, EventArgs e) 
    lblChangingText.Text = "btnPostBackButton did an ajax request when clicked. It should have done a full post back. If you are seeing this then you've selected the drop down list after you pressed btnNonPostBack - which updates lblChangingText."
    lblChangingText.ForeColor = System.Drawing.Color.Red; 

When using the code above, if I click button btnShouldDoAFullPostBack then as far as the user is concerned nothing happens. What actually happens is that the button does a postback - but is encompassed within the radajax manager, meaning that it becomes an ajax "type" request.

I say ajax "type" request, because if you add a client event for the "OnRequestStart" event, the dropdownlist item will fire the "OnRequestStart" event, but the btnShouldDoAFullPostBack.Click event does not fire the "OnRequestStart", meaning that you cannot intercept the event and then force a postback.

I was pointed in the direction of this link http://www.telerik.com/help/aspnet-ajax/ajxexclude.html by one of my collegues, but unfortunately none of the suggested work arounds seem to fix the problem.

Help!?

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 30 Mar 2009, 07:35 AM
Hello tom,

I suggest that you add the below ajax setting to the RadAjaxManager. Then you can try disabling ajax for particular ajax request by handling the OnRequestStart client event as shown here (point 2)).

<telerik:AjaxSetting AjaxControlID="btnShouldDoAFullPostBack">  
   <UpdatedControls>    
       <telerik:AjaxUpdatedControl ControlID="btnShouldDoAFullPostBack" />    
   </UpdatedControls>    
</telerik:AjaxSetting>  

Give it a try and let me know if this works for you.

Best wishes,
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