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

Full post-back occurring for controls added to RadAjaxManagerProxy

1 Answer 22 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 26 Feb 2014, 07:41 PM
I have a main page that contains the radAjaxManager.  Then, on a user control, I have the following defined:

<telerik:RadAjaxManagerProxy ID="rampObjectIndexInfo" runat="server" />
<telerik:RadAjaxLoadingPanel ID="ralpObjectIndexInfo" runat="server" />

Within the user control, I create a series of dynamic controls.  At some times, we create repeating rows of fields where the user can add additional rows (e.g., we initially define 2 rows of three text boxes, but the user can add additional rows as they desire).  We define the buttons as follows (only the minus button is shown, the plus button is defined pretty much the same):

ImageButton minusButton = new ImageButton();
minusButton.ImageUrl = GetString("ObjectDetails.IndexingInfo.RepeatingRowRemove.ImageName");
minusButton.AlternateText = GetString("ObjectDetails.IndexingInfo.RepeatingRowRemove.AltText");
minusButton.OnClientClick = "RemoveLine('" + dataGroupId + "', 'btnpm_" + dataGroupId + "_" + controlSuffix + "'," + controlSuffix + ");";
minusButton.ID = epCustom.ID + "_M_" + (controlSuffix);
minusButton.Style.Add("padding-right", "3px");

//Index info is an array of dynamically created controls that will be displayed to the user
indexInfo.Controls.Add(minusButton);
rampObjectIndexInfo.AjaxSettings.AddAjaxSetting(minusButton, minusButton.Parent, ralpObjectIndexInfo);

The issue I'm having is that instead of executing the OnClientClick event, a full post-back is executed and the form is entirely reloaded (which is what we're trying to avoid since there are a half-dozen other controls that update as well and that causes a major performance hit).

What am I missing?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Feb 2014, 03:28 AM
Hi Matt,

The provided code is working fine at my end. Please have a look into the sample code snippet which works fine at my end. Please provide your full code if it doesn't help.

ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
</telerik:RadAjaxManager>
<uc1:Usercontrol1 ID="Usercontrol11" runat="server" />

ASCX:
<telerik:RadAjaxManagerProxy ID="rampObjectIndexInfo" runat="server" />
<telerik:RadAjaxLoadingPanel ID="ralpObjectIndexInfo" runat="server" Skin="Default" />

UserContol Page JavaScript:
<script type="text/javascript">
    function RemoveLine() {
        alert("Fired");
    }
</script>

ASCX.CS:
protected void Page_Load(object sender, EventArgs e)
{
    ImageButton minusButton = new ImageButton();
    minusButton.ImageUrl = "~/Images/BlackPlus.png";
    minusButton.AlternateText = "Alternate Text";
    minusButton.OnClientClick = "RemoveLine();";
    minusButton.ID = "ImageButton1";
    minusButton.Style.Add("padding-right", "3px");
 
    this.Controls.Add(minusButton);
    rampObjectIndexInfo.AjaxSettings.AddAjaxSetting(minusButton, minusButton.Parent, ralpObjectIndexInfo);
}

Thanks,
Shinu.
Tags
Ajax
Asked by
Matt
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or