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

[Solved] Connecting client-side script to web service created control

1 Answer 135 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rich
Top achievements
Rank 1
Rich asked on 01 Jul 2009, 06:04 PM
Hi there,

I'm currently experiencing an issue with static headers and frozen columns on a RadGrid when I replace the HTML for the RadGrid with a HTML stream from a web service which creates and renders an updated RadGrid.  I know this sounds like a very odd scenario for updating the grid, but this was the design choice due to a number of other static elements we have rendered on the page which often need to be re-rendered when the widget area is resized.

I believe the issue is the result of the client-side javascript not being hooked up to the returned elements.  Here's a basic scenario:

- Load a page with a widget on it which contains a RadGrid.
- Resize the widget.  The resize makes a call in javascript to a web service to get an updated RadGrid.
- In the service method, a Page element is created along with a ScriptManager and a RadGrid, which are added to the page.
- The page is rendered to a text stream by calling HttpContext.Current.Server.Execute.
- The resulting text then has everything but the rendered HTML for the RadGrid removed, and is sent as the result of the service method call.
- A callback handler for the completion of the web service request then replaces the innerHTML of the widget (which was the original RadGrid) with the HTML returned from the web service.

At this point, the grid renders correctly on screen and looks fine.  However, the scrolling now scrolls all data columns, including my frozen columns, and the matching column headers and footers do not move when scrolling as they would when the RadGrid is on the page from the beginning.

So, is there a good way that I can reconnect all of the client-side scripting to my returned HTML, such that it treats this HTML replacement as an actual RadGrid, along with all of the column freezing and scrolling that I get when the page is freshly loaded?

Thank you for your time,

Rich

1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 07 Jul 2009, 10:16 AM
Hello Rich,

Generally you will need to execute $create expression of RadGrid or any IScriptControl whenever the new markup is supplied. For your convenience I am attaching sample project demonstrating this.

Kind regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Rich
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or