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

RadGrid pager problem width .Net UpdatePanel

2 Answers 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mohsen
Top achievements
Rank 1
mohsen asked on 28 Dec 2011, 04:36 PM
Hi,
My scenario is like below:
1: There is an  asp.net UpdatePnale that I defined a RadGrid inside it.
2: I have defined a Pager Template for RadGrid. Template is a user control that contains some javascript and some server controls to navigate RadGrid.(Javasripts used for client events)
3: RadGrid shows some result search and it will appear when user clicks search button and updates UpdatePanel. So there is no any RadGrid in page at first view .
4: My javascript codes of pager uc is rounded by RadScriptBock tag.

My problem is:
1: When I click search button, server fill RadGrid and it appears correctly. But all client evenst that i have attached to pager uc server controls are undefinded and Javascript  error appears in the page. This causes that some controls like RadCombobox renders incorectly.
2: When I click next page button of pager, after server response, all things become ok. So my problem is at first view of appearing RadGrid.

My Idea:
I think when request handles by asp.net update panel it ignores my javascript block . But second time that request handles by RadAjaxManager it registers my javascipts correctly. Am i right? Is there any solution for this?

Any Idea or solution is appreciated.
 
 

2 Answers, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 29 Dec 2011, 02:59 PM
Hello Mohsen,

Loading user controls dynamically causes this type of issue. You could try one of the following approaches:
  • Replace your UpdatePanel with RadAjaxPanel and wrap the user control JavaScript in RadScriptBlock
  • Use the RegisterClientScriptBlock method to manually register the script on control load
Page.RegisterClientScriptBlock("pagerScript", script);

Additionally, you could go through the forum topics below for more information on the topic:

Greetings,
Antonio Stoilkov
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
0
mohsen
Top achievements
Rank 1
answered on 29 Dec 2011, 03:12 PM
Dear Antonio,
Thanks for your perfect answer.

Best Wishes.
Tags
Grid
Asked by
mohsen
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
mohsen
Top achievements
Rank 1
Share this question
or