Hi...
I'm trying to dynamically register some client script in a user control Page_Load method... This user control is triggered by a RadGrid through the EditMode...
AJAX SETTINGS :
GRID :
USER CONTROL UI
USER CONTROL SERVER SIDE CODE
Quite basic stuff... I know that there's some ways to achieve this without any dynamic script registering but for some reasons, I need to do it that way...
I tried a bunch of stuff without any success...
- EnablePageHeadUpdate = "true" in the AjaxManager
- RadScriptManager.RegisterClientScriptBlock
- Page.ClientScript.RegisterClientScriptBlock
- RadAjaxManager.GetCurrent(Page).ResponseScripts
Some remarks...
- Works well when using a radwindow that calls a page containing the user control.
- Works well when I remove the ajaxsettings that update the RadGrid in the RadAjaxManager.
Am I missing something? Maybe I'm not using the grid edit mode the right way... Is there a way to achieve this?
Thanks for your help : )
Jose
I'm trying to dynamically register some client script in a user control Page_Load method... This user control is triggered by a RadGrid through the EditMode...
AJAX SETTINGS :
| <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> |
| <AjaxSettings > |
| <telerik:AjaxSetting AjaxControlID="RadGrid1" > |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadGrid1"/> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
GRID :
| <telerik:RadGrid ID="RadGrid1" runat="server"> |
| <MasterTableView Name="masterView" GridLines="None" EditMode="PopUp" CommandItemDisplay="Top"> |
| <CommandItemSettings AddNewRecordText="Add new entry" RefreshText="Refresh" /> |
| <EditFormSettings UserControlName="Control1.ascx" EditFormType="WebUserControl"> |
| </EditFormSettings> |
| </MasterTableView> |
| </telerik:RadGrid> |
USER CONTROL UI
| <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Control1.ascx.vb" Inherits="TestClientScriptRegister.Control1" %> |
| <asp:Button ID="Button1" runat="server" Text="Button" /> |
USER CONTROL SERVER SIDE CODE
| Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
| Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "Test", Me.GetScript(), True) |
| Me.Button1.Attributes("OnClick") = "Test()" |
| End Sub |
| Private Function GetScript() As String |
| Dim sb As New System.Text.StringBuilder() |
| sb.Append("function Test() {") |
| sb.Append("alert('what?');") |
| sb.Append("}") |
| Return sb.ToString() |
| End Function |
Quite basic stuff... I know that there's some ways to achieve this without any dynamic script registering but for some reasons, I need to do it that way...
I tried a bunch of stuff without any success...
- EnablePageHeadUpdate = "true" in the AjaxManager
- RadScriptManager.RegisterClientScriptBlock
- Page.ClientScript.RegisterClientScriptBlock
- RadAjaxManager.GetCurrent(Page).ResponseScripts
Some remarks...
- Works well when using a radwindow that calls a page containing the user control.
- Works well when I remove the ajaxsettings that update the RadGrid in the RadAjaxManager.
Am I missing something? Maybe I'm not using the grid edit mode the right way... Is there a way to achieve this?
Thanks for your help : )
Jose