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

set_text notification

3 Answers 87 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Fabio Cirillo
Top achievements
Rank 1
Fabio Cirillo asked on 18 Dec 2012, 03:04 PM
hi,
i've a problem with the javascript function. when start the second if the compilator see me this error:
Run-time error of Microsoft JScript: Object does not support this property or method 'set_text' on this code

why?

function CallNotification() {
    var PwdAttuale = '<%=ViewState("Passwordnow")%>';
    var notification = document.getElementById("<%= RadNotification1.ClientID %>");
    var txtpwdnow = document.getElementById("<%= txtpwdnow.ClientID %>");
    var txtpwdnew = document.getElementById("<%= txtpwdnew.ClientID %>");
    var txtpwdnewconf = document.getElementById("<%= Txtpwdnewconf.ClientID %>");
    if (txtpwdnow.value != PwdAttuale) {
        var messaggio = "Password attuale errata.";
        notification.set_text(messaggio);
        notification.show();
        return false;
    }
    if (txtpwdnew.value != txtpwdnewconf.value) {
         var messaggio = "Password di conferma errata.";
         notification.set_text(messaggio);
         notification.show();
         return false;
     }
 }

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Dec 2012, 06:51 AM
Hi,

I tried to replicate the issue at my end. But no avail. Please make sure that you are using the latest version of RadControls.

JS:
var notification = $find("<%= RadNotification1.ClientID %>");
var messaggio = "Password di conferma errata.";
notification.set_text(messaggio);
notification.show();

Hope this helps.

Regards,
Shinu.
0
Fabio Cirillo
Top achievements
Rank 1
answered on 19 Dec 2012, 08:19 AM
Hi,
i'm using the 2012_3_1205 version.
I'm seeing that even the method notification.show is supported in the first and second if.
this my page code:
i dont know because this code is not correct
<%@ Page Language="vb" AutoEventWireup="false" CodeFile="Changepwd.aspx.vb" Inherits="Changepwd" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="width: 320px; font-family: Verdana; font-size: small;">
                               <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                                 <script type="text/javascript">
                                     function GetRadWindow() {
                                         var oWindow = null;
                                         if (window.radWindow) oWindow = window.radWindow;
                                         else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                                         return oWindow;
                                     }
                                     function Close() {
                                         GetRadWindow().close();
                                     }
                                     function CallNotification() {
                                         var PwdAttuale = '<%=ViewState("PasswordAttuale")%>';
                                         var notification = document.getElementById("<%= RadNotification1.ClientID %>");
                                         var txtpwdnow = document.getElementById("<%= txtpwdnow.ClientID %>");
                                         var txtpwdnew = document.getElementById("<%= txtpwdnew.ClientID %>");
                                         var txtpwdnewconf = document.getElementById("<%= Txtpwdnewconf.ClientID %>");
                                         if (txtpwdnow.value != PwdAttuale) {
                                             var messaggio = "Password attuale errata.";
                                             notification.set_text(messaggio);
                                             notification.show();
                                             return false;
                                         } else  if (txtpwdnew.value != txtpwdnewconf.value) {
                                                 var messaggio = "Password di conferma errata.";
                                                 notification.set_text(messaggio);
                                                 notification.show();
                                                 return false;
                                                 }
                                      }
                                     </script>
                             </telerik:RadCodeBlock
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" height="150px"
                HorizontalAlign="NotSet" LoadingPanelID="RadAjaxLoadingPanel1"
                width="320px">
                <table style="width:100%;">
                    <tr>
                        <td colspan="2" style="padding-left: 10px; padding-top: 10px">
                            <telerik:RadTextBox ID="Txtpwdnow" Runat="server" Label=" Password attuale:"
                                LabelWidth="110px" MaxLength="20" TextMode="Password" Width="300px">
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="padding-left: 10px">
                            <telerik:RadTextBox ID="Txtpwdnew" Runat="server" Label="Nuova password:"
                                LabelWidth="110px" MaxLength="20" TextMode="Password" Width="300px">
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="padding-left: 10px">
                            <telerik:RadTextBox ID="Txtpwdnewconf" Runat="server"
                                Label="Conferma password:" LabelWidth="110px" MaxLength="20"
                                TextMode="Password" Width="300px" AutoPostBack="False">
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="padding-left: 10px">
 
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:ImageButton ID="Imgbtnconferma" runat="server"
                                ImageUrl="~/Image/conferma.png" OnClientClick="CallNotification()" />
                        </td>
                        <td align="center">
                            <asp:ImageButton ID="ImgBtnEsci" runat="server"
                        ImageUrl="~/Image/esci1.png" />
                        </td>
                    </tr>
                </table>
            </telerik:RadAjaxPanel>   
    </div>
        <p>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"
                Skin="Office2010Silver" BorderColor="#D5842B" BorderStyle="Double"
                BorderWidth="1px" Width="320px" ViewStateMode="Disabled">
            </telerik:RadAjaxLoadingPanel>
        </p>
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="Imgbtnconferma">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1"
                            LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
    </telerik:RadAjaxManager>
        <telerik:RadNotification ID="RadNotification1" runat="server"
           AutoCloseDelay="3500" Height="100px" Skin="Simple" Title="Trycontact"
           TitleIcon="~/Image/iconlogo.png" Width="320px" Position="Center">
        </telerik:RadNotification>
    </form>
</body>
</html>
0
Marin Bratanov
Telerik team
answered on 19 Dec 2012, 02:26 PM
Hi Fabio,

In order to get a reference to a RadControl you need to use the $find() method (which is actually a shortcut to the findComponent() method). The document.getElementById() call returns a DOM object and not the script control object that you need since it exposes the API of the control. This is explained here, for example: http://www.telerik.com/help/aspnet-ajax/notification-client-side-overview.html.


All the best,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Notification
Asked by
Fabio Cirillo
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Fabio Cirillo
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or