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

ComboBox AutomaticLoadOnDemand - multiple postbacks and detection of them

1 Answer 24 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 11 May 2012, 12:17 PM
Hi,

I am using the radcombobox with automatica load on demand:

<telerik:RadComboBox ID="cboSKU" runat="server" 
        DataTextField="STCode" DataValueField="STCode" MarkFirstMatch="true" ShowToggleImage="false"
        EnableAutomaticLoadOnDemand="true" ShowMoreResultsBox="true" ItemsPerRequest="30"
        AutoPostBack="true" onselectedindexchanged="cboSKU_SelectedIndexChanged"
        >
 
this works as expected. This combo box is on an aspx page using a master page. On the master page I'm logging events - however I do not want to capture ajax postbacks. (I do want to capture non ajax postbacks, but not postbacks from, for example, the combo box repopulating values as you type)

i have tried:
if (RadAjaxManager1.IsAjaxRequest == false)
            {
                AddLogEntry();
            }

and

if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack == false)
            {
                AddLogEntry();
            }

with no success.

Any advice would be appreciated.

Thank you, 
Ryan

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 16 May 2012, 11:13 AM
Hi Ryan,

The following works fine when I test it locally:
protected void Page_Load(object sender, EventArgs e)
{
    if(IsAjaxPostback(this)){
        //Handle AJAX postback.
    }else {
        //Handle regular postback.
    }
}
 
public bool IsAjaxPostback(Page page)
{
    var sm = ScriptManager.GetCurrent(page);
    return (sm != null && sm.IsInAsyncPostBack);
}
<telerik:RadComboBox runat="server" ID="RadComboBox1" EnableAutomaticLoadOnDemand="True"
    DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="ID" ItemsPerRequest="10" AutoPostBack="true"
    ShowMoreResultsBox="true">
</telerik:RadComboBox>

Could you send over a sample page of your attempts, via a support ticket, so we will be able to troubleshoot the issue locally?

Greetings,
Ivana
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
ComboBox
Asked by
Ryan
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or