Hi, we have an application which is growing rapidly and we use a lot of
the Rad-controls which are getting better and better. In this
applicatoin we have a master-page which uses the RadSplitter to divide
the page in sperate sections. In the header-section we use a
UserControl containing the RadMenu and three RadToolbars.
On one of these RadToolbars I have added a button which should invoke the Radspell functionality. I came accross this thread, which is the functionality I try to accomplice, but I cannot get it to work. I tried the following code:
I use this code in the PreRender of the UserControl. When I use this I get a javascript error saying that the id of the toolbar I reference does not exists. I checked this in the HTML-output, but he Id of the RadToolbar is ok. It is on the page. Then I tried to attach the function clientClick_eventHandler directly in the Radtoolbar. Thus setting OnClientButtonClicked="clientClick_eventHandler" of the toolbar. This doesn't throw the javascript-exception. But when I click the toolbar-button, it cannot find the CommandName of the sender-object. However there is a senderobject. I modifed the javascript function not to check for sender.CommandName but alert(sender). It shows me an alert box with [object Object]. So there is an object present.
The concent of the usercontrol is:
Can anyone point me in the right direction?
P.S.: Using the above result in :
Error: ctl00_ctl10_rtbMain is not defined
Source File: http://localhost:64121/WebSite/MextraToday/default.aspx
where ctl00_ctl10_rtbMain is the clientId of the RadToolbar to which the onclientclick event should be wired.
Line: 3069
On one of these RadToolbars I have added a button which should invoke the Radspell functionality. I came accross this thread, which is the functionality I try to accomplice, but I cannot get it to work. I tried the following code:
StringBuilder javaScript = new StringBuilder(); |
javaScript.Append("<script language='javascript'>"); |
javaScript.Append(rtbMain.ClientID + ".attachEvent('OnClientClick','click_handler');"); |
javaScript.Append("function clientClick_eventHandler(sender, e)"); |
javaScript.Append("{"); |
javaScript.Append("if(sender.CommandName == 'spellCheck')"); |
javaScript.Append("{"); |
javaScript.Append("alert(e);"); |
javaScript.Append("return false;"); |
javaScript.Append("}"); |
javaScript.Append("}"); |
javaScript.Append("</script>"); |
if (!Page.ClientScript.IsStartupScriptRegistered("clientSpellScript")) |
Page.ClientScript.RegisterStartupScript(Page.GetType(), "clientSpellScript", javaScript.ToString()); |
The concent of the usercontrol is:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WindowsMenu.ascx.cs" Inherits="UserControls_WindowsMenu" %> |
<%@ Register Src="~/UserControls/Common/shiftPicker.ascx" TagName="ShiftPicker" TagPrefix="mextra" %> |
<div style="width: 100%; z-index: 100;"> |
<telerik:RadMenu ID="rdmCommonMenu" runat="server" DataFieldParentID="MenuParentId" |
Width="100%" CollapseDelay="0" Style="z-index: 100;" DataNavigateUrlField="NavigationUrl" |
ClickToOpen="True" DataTextField="MenuItem" DataValueField="MenuId" OnDataBound="rdmCommonMenu_DataBound" |
DefaultGroupSettings-ExpandDirection="Down" DataFieldID="MenuId" meta:resourcekey="Resource1" |
MaxDataBindDepth="-1" OnLoad="rdmCommonMenu_Load" OnDataBinding="rdmCommonMenu_DataBinding"> |
<CollapseAnimation Type="None" Duration="200" /> |
<ExpandAnimation Type="None" /> |
</telerik:RadMenu> |
</div> |
<asp:Panel ID="pnlToolbar" runat="server" Width="100%" Height="60px" CssClass="Toolbar" |
meta:resourcekey="pnlToolbarResource1" OnDataBinding="pnlToolbar_DataBinding"> |
<telerik:RadToolBar ID="rtbMain" runat="server" Width="350px" Height="60px" OnButtonClick="rtbMain_OnClick" |
meta:resourcekey="rtbMainResource1" OnPreRender="rtbMain_PreRender" OnClientButtonClicked="clientClick_eventHandler"> |
<Items> |
<telerik:RadToolBarButton ImagePosition="AboveText" ToolTip="New Document" CausesValidation="False" |
CommandName="new" ImageUrl="~/Images/Toolbar/new.gif" Text="new" runat="server" |
meta:resourcekey="RadToolBarButtonResource1" /> |
<telerik:RadToolBarButton ImagePosition="AboveText" ToolTip="Save" CommandName="save" |
ImageUrl="~/Images/Toolbar/save.gif" Text="save" runat="server" meta:resourcekey="RadToolBarButtonResource2" /> |
<telerik:RadToolBarButton ImagePosition="AboveText" ToolTip="Refresh" CausesValidation="False" |
CommandName="refresh" Text="Refresh" ImageUrl="~/Images/Toolbar/refresh.gif" |
meta:resourcekey="RadToolBarButtonResource3" runat="server" /> |
<telerik:RadToolBarButton ToolTip="Back" ImagePosition="AboveText" CausesValidation="False" |
CommandName="back" Text="Backward" ImageUrl="~/Images/Toolbar/backGreen.gif" |
runat="server" /> |
<telerik:RadToolBarButton ToolTip="Forward" ImagePosition="AboveText" CausesValidation="False" |
CommandName="forward" Text="Forward" ImageUrl="~/Images/Toolbar/forwardGreen.gif" |
runat="server" /> |
<telerik:RadToolBarButton ToolTip="Spell Check" Value="spellCheck" CommandName="spellCheck" |
Text="Spell Check" ImageUrl="~/Images/Toolbar/spellCheck.gif" runat="server" ImagePosition="AboveText" Enabled="false"> |
</telerik:RadToolBarButton> |
</Items> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
</telerik:RadToolBar> |
<telerik:RadToolBar ID="rtbMisc" runat="server" Height="60px" Width="350px" OnButtonClick="rtbMisc_ButtonClick"> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
<Items> |
<telerik:RadToolBarButton runat="server" ImagePosition="AboveText" ImageUrl="~/Images/Toolbar/client_report.gif" |
Text="Alg. Rapportage" PostBack="true" CommandName="GeneralReport" CausesValidation="False"> |
</telerik:RadToolBarButton> |
<telerik:RadToolBarButton meta:resourcekey="RadToolBarButtonResource6" runat="server"> |
<ItemTemplate> |
<telerik:RadSpell ID="rscSpell" runat="server" ButtonType="None" ControlToCheck="" |
meta:resourcekey="rscSpellResource1" SupportedLanguages="en-US,English" /> |
</ItemTemplate> |
</telerik:RadToolBarButton> |
<telerik:RadToolBarButton runat="server" ImagePosition="AboveText" ImageUrl="~/Images/Toolbar/voorblad.gif" |
PostBackUrl="~/ClientFront/ClientFront.aspx" Text="Voorblad" ToolTip="Voorblad" |
CommandName="ClientPage" /> |
<telerik:RadToolBarButton runat="server" ImagePosition="AboveText" ImageUrl="~/Images/Toolbar/MextraToday.gif" |
meta:resourcekey="RadToolBarButtonResource8" PostBackUrl="~/MextraToday/Default.aspx" |
Text="MeXtra Today" ToolTip="MeXtra Today" /> |
<telerik:RadToolBarButton ToolTip="Agenda" ImagePosition="AboveText" Text="Agenda" |
PostBackUrl="~/Appointment/Appointment.aspx" ImageUrl="~/Images/Toolbar/Calendar.gif" |
runat="server" /> |
<telerik:RadToolBarButton runat="server" PostBack="False" ToolTip="Help" CausesValidation="False" |
Visible="False"> |
<ItemTemplate> |
<div style="margin-top: 5px; margin-left: 10px" onclick="displayHelp('Open');" onmouseover="style.cursor='hand'"> |
<asp:Image runat="server" ID="imgHelp" ImageUrl="~/Images/32X32/help2.gif" /> |
</div> |
</ItemTemplate> |
</telerik:RadToolBarButton> |
<telerik:RadToolBarButton runat="server" PostBack="False" ToolTip="Filter" CausesValidation="False"> |
<ItemTemplate> |
<div style="margin-top: 5px; margin-left: 10px" onclick="displayFilter();" onmouseover="style.cursor='hand'"> |
<asp:Image runat="server" ID="imgHelp" ImageUrl="~/Images/32X32/funnel.gif" /> |
</div> |
</ItemTemplate> |
</telerik:RadToolBarButton> |
</Items> |
</telerik:RadToolBar> |
<telerik:RadToolBar ID="rtbHCP" runat="server" Height="60px" OnButtonClick="rtbHCP_ButtonClick" |
OnPreRender="rtbHCP_PreRender" Width="170px"> |
<CollapseAnimation Duration="200" Type="OutQuint" /> |
<Items> |
<telerik:RadToolBarButton runat="server" ImagePosition="AboveText" ImageUrl="~/Images/Toolbar/daily_report.gif" |
PostBackUrl="~/Reports/DailyReport.aspx" Text="Dagrapportage" CommandName="DailyReport"> |
</telerik:RadToolBarButton> |
<telerik:RadToolBarButton runat="server" CausesValidation="False" ImagePosition="AboveText" |
ImageUrl="~/Images/Toolbar/listview.gif" Text="Overzicht"> |
</telerik:RadToolBarButton> |
</Items> |
</telerik:RadToolBar> |
</asp:Panel> |
P.S.: Using the above result in :
Error: ctl00_ctl10_rtbMain is not defined
Source File: http://localhost:64121/WebSite/MextraToday/default.aspx
where ctl00_ctl10_rtbMain is the clientId of the RadToolbar to which the onclientclick event should be wired.
Line: 3069