Appeler fonction javaScript à partir du code C#
Bonjour,
J'ai un webControl qui contient un TreeView(RadTreeView-Telerik) et deux fonction javascript.
Dans la page où j'appelle ce WebControl, je dois associer mon TreeView à un AjaxManager (RadAjaxManager), et comme propriétés le "ClientEvents"
Voissi mon Code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| //assosier le RadtTreeView du webControle au AjaxManager
RadTreeView rglistOfProduct = (RadTreeView)posteType.FindControl("RadTreeViewCatalog");
Control spanDetail = posteType.FindControl("spanDetail");
AjaxSetting ajaxSetting1 = new AjaxSetting(rglistOfProduct.ClientID);
AjaxUpdatedControl updateControl = new AjaxUpdatedControl(rglistOfProduct.ClientID, rglistOfProduct.ClientID);
ajaxSetting1.UpdatedControls.Add(updateControl);
updateControl = new AjaxUpdatedControl(spanDetail.ClientID, spanDetail.ClientID);
ajaxSetting1.UpdatedControls.Add(updateControl);
RadAjaxManager1.ClientEvents.OnRequestStart = "RequestStart";//Ici je dois spécifier la fonction qui doit être appellée
RadAjaxManager1.ClientEvents.OnResponseEnd = "ResponseEnd";//Ici je dois spécifier la fonction qui doit être appellée
RadAjaxManager1.AjaxSettings.Add(ajaxSetting1); |
Mais avec ce code ça ne passe pas pour ces deux linges (ils ne trouve pas les fonctions) :
Code:
1 2
| RadAjaxManager1.ClientEvents.OnRequestStart = "RequestStart";//Ici je dois spécifier la fonction qui doit être appellée
RadAjaxManager1.ClientEvents.OnResponseEnd = "ResponseEnd";//Ici je dois spécifier la fonction qui doit être appellée |
mes fonction qui se trouve dans le webControl :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
var currentLoadingPanel = null;
var currentUpdatedControl = null;
function RequestStart(sender, args) {
currentLoadingPanel = $find("<%= UpdatePanelCatalog.ClientID%>");
if (args.get_eventTarget() == "<%= RadTreeViewCatalog.UniqueID %>") {
currentUpdatedControl = "<%= RadTreeViewCatalog.ClientID %>";
//show the loading panel over the updated control
currentLoadingPanel.show(currentUpdatedControl);
}
}
function ResponseEnd() {
//hide the loading panel and clean up the global variables
if (currentLoadingPanel != null) {
currentLoadingPanel.hide(currentUpdatedControl);
}
currentUpdatedControl = null;
currentLoadingPanel = null;
}
</script>
</telerik:RadCodeBlock> |
Merci d'avance