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

ajaxify specific controls dynamically ArgumentNullException no page parameter

6 Answers 117 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Rich
Top achievements
Rank 1
Rich asked on 25 May 2010, 04:40 PM
Hi All,

I am attempting to ajaxify specific controls dynamically. I have a repeater and i want to ajaxify image buttons inside the repeater.

On ItemCreated for the repeater i am:

protected void RptCategories_ItemCreated(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ImageButton imgbtn = (ImageButton)e.Item.FindControl("iBtnRemoveCategory");
                this.RadAjaxManager1.AjaxSettings.AddAjaxSetting(imgbtn, RptCategories, RadAjaxLoadingPanel1);
            }
        }

The line where i am adding the AjaxSetting i am getting the error: ArgumentNullException was unhandled by user code, value cannot be null, Parameter Page.

It seems the RadAjaxManager doesn't know where it is.. this is a form page with a masterpage.. no usercontrols..Please help. THanks.

6 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 28 May 2010, 10:35 AM
Hi Rich,

Note that you should always add AJAX pair dynamically in a Page event handler, which is executed each time during the page lifecycle (Page_Load, Page_PreRender) so that the control could be ajaxified when the page is initially loaded. Please review the following help topic which elaborates on this scenario.


Sincerely yours,
Maria Ilieva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rich
Top achievements
Rank 1
answered on 28 May 2010, 02:50 PM
Hi The buttons are inside a Repeater.. so how would i add dynamically in the page load or prerender? The repeater is likely not databound at this point.



0
Maria Ilieva
Telerik team
answered on 31 May 2010, 02:00 PM
Hello Rich,

I would suggest you to wrap the Repeater into an asp Panel and add the whole Panel to update itself on Page_Load or Page_PreRender events. Check it out and let me know if it makes any difference.


Best wishes,
Maria Ilieva
the Telerik team


Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rich
Top achievements
Rank 1
answered on 31 May 2010, 02:11 PM
What do you mean when you say:

"add the whole Panel to update itself on Page_Load or Page_PreRender events"??

thanks
0
Maria Ilieva
Telerik team
answered on 31 May 2010, 03:36 PM
Hi Rich,

Your settings should look like this:

ASPX:
<asp:Panel ID="Panel1" runat="server">
            <asp:Repeater ID="RptCategories" runat="server">
            </asp:Repeater>
</asp:Panel>

CS:
protected void Page_Load(object sender, EventArgs e)
    {
        this.RadAjaxManager1.AjaxSettings.AddAjaxSetting(Panel1, Panel1, RadAjaxLoadingPanel1); 
    }




Best wishes,
Maria Ilieva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
James
Top achievements
Rank 1
answered on 19 Aug 2013, 12:57 PM
For our situation, the fix was to put the RadAjaxManager.AjaxSettings.AddAjaxSetting after adding the panel to the Controls (Controls.Add(panel)).
Tags
Ajax
Asked by
Rich
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Rich
Top achievements
Rank 1
James
Top achievements
Rank 1
Share this question
or