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

javascript code dont fire in nested user controls

1 Answer 38 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Mehdi
Top achievements
Rank 1
Mehdi asked on 10 Feb 2013, 06:50 PM
i define a user controls inside other user control and define a 
RadScriptBlock,place script code in it,but script block dont fire.please
 help me.
my code is:

<telerik:RadScriptBlock
ID="RadScriptBlock1" runat="server"> <script type="text/javascript" language="javascript"> function refreshGrid(arg) { alert("1234"); $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind"); } function RowDblClick(sender, eventArgs) { window.radopen("Details.aspx?codemessage=" + eventArgs.getDataKeyValue("codeadvertisment"), "UserListDialog"); } function OpenFileExplorerDialog() { var wnd = $find("<%= ExplorerWindow.ClientID %>"); wnd.show(); } //This function is called from the Explorer.aspx page function OnFileSelected(wnd, fileSelected) { var textbox = $get("<%= UploadPicture.ClientID %>"); textbox.value = fileSelected; } function ShowMessage(sender, args) { var id = args.getDataKeyValue("codeadvertisment"); var wnd = window.radopen("Details.aspx?codemessage=" + id, null); //Get the clicked row var index = args.get_itemIndexHierarchical(); var item = args.get_tableView().get_dataItems()[index]; var rowElement = item.get_element(); //Get coordinates of the row and reposition the window relative to it var bounds = $telerik.getBounds(rowElement); wnd.moveTo(bounds.x + 120 + index * 10, bounds.y - 180); } </script> </telerik:RadScriptBlock>

1 Answer, 1 is accepted

Sort by
0
MasterChiefMasterChef
Top achievements
Rank 2
answered on 13 Feb 2013, 08:11 PM
Hi Mehdi,

Is there any way you can provide the context that the RadScriptBlock is in? There probably isn't anything wrong with your functions, rather, the DOM is probably not able to find the script tag if it is nested so deep into your code. Is there any way you can just relocate these functions into a script that isn't inside of two user controls?

Good luck,
Master Chief
Tags
Ajax
Asked by
Mehdi
Top achievements
Rank 1
Answers by
MasterChiefMasterChef
Top achievements
Rank 2
Share this question
or