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

Update control outside the Grid

1 Answer 58 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vipul
Top achievements
Rank 1
Vipul asked on 09 Aug 2011, 08:41 PM
I'm trying to update the value of the control that is outside the dynamically created RadGrid. I'm using the reference - http://www.telerik.com/help/aspnet/grid/grduseajaxtoupdateoutsidecontrols.html.
I need to update the text of the Label control(lies out of the grid) when the textbox's (in the grid) text is changed.

The JS within the literal control is created but is never called. I'm using the RadAjaxManager to update the grid and the Label. 

Can someone please see what the problem is and offer a solution
 protected override void OnLoad(EventArgs e)<br>    {<br>        RadGrid grid = (RadGrid)pc1.FindControl("dgSample");<br>        RadAjaxManager1.AjaxSettings.AddAjaxSetting(grid, grid);<br>        RadAjaxManager1.AjaxSettings.AddAjaxSetting(grid, Label2);<br>        base.OnLoad(e);<br>    }

 protected void cTextbox_TextChanged(object sender, EventArgs e)<br>    {<br>        LiteralControl ctrl1 = new LiteralControl<br>                       (String.Format("<script type='text/javascript'>document.getElementById('{0}').innerHTML = '{1}';</script>", this.FindControl("Label2").ClientID, "Teexx"));<br><br><br>        //You should add the LiteralControl to the Controls collection of RadGrid in order to make it work with Telerik RadGrid AJAX<br>        this.Controls.Add(ctrl1);<br>        return;<br>    }

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 11 Aug 2011, 02:34 PM
Hello Vipul,

I recommend that you use the ResponseScripts property of the RadAjaxManager to register the client script. Please review the Executing custom javascript code after AJAX update help topic for additional information.

I hope this helps.

Kind regards,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Vipul
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or