Server Side Event not firing

8 posts, 0 answers
  1. Robert Graff
    Robert Graff avatar
    34 posts
    Member since:
    Jun 2007

    Posted 12 Dec 2007 Link to this post

    Hello, I am trying to get the RadColourPicker running on my webapge but with no luck. I am trying to use the example that you have posted here
     but the server-side click event simply isn't firing. Here's my code:

    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="PRAMIS.master.cs" Inherits="PRAMIS" %> 
    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
        Namespace="System.Web.UI" TagPrefix="asp" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <%@ Register Assembly="RadMenu.Net2" Namespace="Telerik.WebControls" TagPrefix="radM" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml" > 
    <head runat="server"
        <title>Untitled Page</title> 
        <link href="PRAMIS.css" rel="stylesheet" type="text/css" /> 
    </head> 
    <body bgcolor="#E3E3E3" style="margin-top:1px;margin-left:0px;margin-right:0px" runat="server" id="objBody"
        <form id="form1" runat="server"
    <asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager> 
        <div> 
            <table border="0" cellpadding="0" cellspacing="0" width="100%"
                <tr> 
                    <td bgcolor="#efab00" style="border-left: #efab00 1px solid;"><img src="/Images/PRAMIS_Wide.jpg" /></td
                </tr> 
                <tr> 
                    <td bgcolor="#efab00" colspan="2" style="border-left: #efab00 1px solid;">&nbsp;</td> 
                </tr> 
                <tr> 
                    <td colspan="2" valign="top"><table style="width: 100%" cellpadding="0" cellspacing="0"
                            <tr> 
                                <td align="center" colspan="2" valign="top"><radM:RadMenu ID="rmenuPramis" runat="server" SkinsPath="/App_Themes/RadMenu" Width="99.9%" RadControlsDir="/" Skin="Web20" DataSourceID="SiteMapDataSource1"></radM:RadMenu> 
    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" /></td
                            </tr> 
                        <tr> 
                            <td align="right" colspan="2" valign="top"
                                <table cellpadding="2" cellspacing="2" style="width: 100%"
                                    <tr> 
                                        <td align="left" valign="top"
                                            <asp:SiteMapPath ID="SiteMapPath1" runat="server" CssClass="ReadOnlyText"></asp:SiteMapPath> 
                                        </td> 
                                        <td align="right"
                                            <table> 
                                                <tr> 
                                                    <td><asp:Label ID="Label1" runat="server" CssClass="Heading" Text="User Name:"></asp:Label></td
                                                    <td align="left"><asp:LoginName ID="LoginName1" runat="server" CssClass="ReadOnlyText" /></td
                                                </tr> 
                                                <tr> 
                                                    <td valign="top"
                                                        <asp:Label ID="Label2" runat="server" CssClass="Heading" Text="Bg Colour:"></asp:Label></td
                                                    <td align="left"
                                                        <asp:UpdatePanel ID="UpdatePanel1" runat="server"
                                                        <ContentTemplate> 
                                                        <telerik:radcolorpicker id="rcpColours" preset="Standard" runat="server" AutoPostBack="true" OnColorChanged="rcpColours_ColorChanged" style="float:left;margin:0px 20px 11px 0px;"></telerik:radcolorpicker> 
                                                        </ContentTemplate> 
                                                        </asp:UpdatePanel> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td></td
                                                    <td align="left"><asp:LoginStatus ID="LoginStatus1" runat="server" CssClass="ReadOnlyText" LogoutAction="RedirectToLoginPage" /></td
                                                </tr> 
                                            </table> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </td> 
                        </tr> 
                        </table> 
                    </td> 
                </tr> 
               </table> 
               <table width="100%" cellpadding="12"><tr><td
            <asp:contentplaceholder id="cphMainForm" runat="server"
             
            </asp:contentplaceholder> 
            </td></tr
            </table> 
        </div> 
        </form> 
    </body> 
    </html> 
     


    C#
    using System; 
    using System.Data; 
    using System.Configuration; 
    using System.Collections; 
    using System.Web; 
    using System.Web.Security; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.WebControls.WebParts; 
    using System.Web.UI.HtmlControls; 
    using System.Drawing; 
     
    public partial class PRAMIS : System.Web.UI.MasterPage 
        protected void Page_Load(object sender, EventArgs e) 
        { 
     
            try 
            { 
                Page.Title = ConfigurationManager.AppSettings["TitleBarText"]; 
     
                objBody.Attributes["bgColor"] = Profile.bgColour; 
                            
                             
            } 
            catch (Exception ex) 
            { 
     
            } 
        } 
        protected void ibtnBlue_Click(object sender, ImageClickEventArgs e) 
        { 
     
            Profile.bgColour = "#C4ECFF"
            Profile.Save(); 
            objBody.Attributes["bgColor"] = Profile.bgColour; 
     
             
        } 
        protected void ibtnPink_Click(object sender, ImageClickEventArgs e) 
        { 
            Profile.bgColour = "#FFD8F5"
            Profile.Save(); 
            objBody.Attributes["bgColor"] = Profile.bgColour; 
        } 
     
        protected void ibtnSilver_Click(object sender, ImageClickEventArgs e) 
        { 
            Profile.bgColour = "#FEFEFE"
            Profile.Save(); 
            objBody.Attributes["bgColor"] = Profile.bgColour; 
     
        } 
     
        protected void rcpColours_ColorChanged(object sender, EventArgs e) 
        { 
            Profile.bgColour = ColorTranslator.ToHtml(rcpColours.SelectedColor); 
            Profile.Save(); 
            objBody.Attributes["bgColor"] = Profile.bgColour; 
        } 
     
     

    Any advise you can give would be much appreciated; Basically, I am trying to fire a server-side event when a colour is clicked, but this isn't happening.




  2. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts
    Member since:
    Sep 2012

    Posted 13 Dec 2007 Link to this post

    Hello Robert Graff,

    I deleted some lines of code to run your example and I also put a label in the update panel. The label is updated when the ColorPicker items are clicked:
    MasterPage ASPX:

    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="pages_ColorPicker_Tickets_Menu_MasterPage" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>    
    <%@ Register Assembly="RadMenu.Net2" Namespace="Telerik.WebControls" TagPrefix="radM" %>    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">    
        
    <html xmlns="http://www.w3.org/1999/xhtml" >    
    <head id="Head1" runat="server">    
        <title>Untitled Page</title>    
        <link href="PRAMIS.css" rel="stylesheet" type="text/css" />    
    </head>    
    <body bgcolor="#E3E3E3" style="margin-top:1px;margin-left:0px;margin-right:0px" runat="server" id="objBody">    
        <form id="form1" runat="server">    
    <asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager>    
        <div>    
        
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">    
                <ContentTemplate>    
                <asp:Label ID="Label2" runat="server" CssClass="Heading" Text="Bg Colour:"></asp:Label> 
                <telerik:radcolorpicker   
                id="rcpColours" preset="Standard" runat="server"   
                AutoPostBack="true"   
                OnColorChanged="rcpColours_ColorChanged"   
                style="float:left;margin:0px 20px 11px 0px;"></telerik:radcolorpicker>    
                </ContentTemplate>    
            </asp:UpdatePanel>    
            <asp:contentplaceholder id="cphMainForm" runat="server">    
                
            </asp:contentplaceholder>    
              
        </div>    
        </form>    
    </body>    
    </html>    
     

    MasterPage Codebehind:
    using System;  
    using System.Data;  
    using System.Configuration;  
    using System.Collections;  
    using System.Web;  
    using System.Web.Security;  
    using System.Web.UI;  
    using System.Web.UI.WebControls;  
    using System.Web.UI.WebControls.WebParts;  
    using System.Web.UI.HtmlControls;  
    using System.Drawing;    
     
     
    public partial class pages_ColorPicker_Tickets_Menu_MasterPage : System.Web.UI.MasterPage  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
        }  
       
     
        protected void rcpColours_ColorChanged(object sender, EventArgs e)  
        {  
            Label2.Text = ((Telerik.Web.UI.RadColorPicker)sender).SelectedColor.ToString();  
        }    
     
    }  
     

    If the code above doesn't work on your side, please download the latest version of RadControls "Prometheus" - the "Futures" which is available for download in your Client.Net account. 
     
    If you still experience problems, please open a new support ticket and send us running project, where we can observe the issue. Once we receive it we will do our best to help you.



    Sincerely yours,
    Petio Petkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  3. Robert Graff
    Robert Graff avatar
    34 posts
    Member since:
    Jun 2007

    Posted 14 Dec 2007 Link to this post

    Unfortunately this still doesn't work for me.

    As soon as I hover over a colour, I get a javascript error which states:

    'Sys' is undefined

    and when I click on a colour, it doesn't cause a postback event

  4. Robert Graff
    Robert Graff avatar
    34 posts
    Member since:
    Jun 2007

    Posted 14 Dec 2007 Link to this post

    Just to confirm, before trying this, I downloaded Prometheus Futures.

    When I hover over the RadColorPicker control, it states that it's version 2007.3.1205.0, is this the latest version?

    Also, I deleted the RadColorPicker that I had on the form and dragged the control from the toolbox onto the form before I carried out the test.

    Thanks.

  5. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts
    Member since:
    Sep 2012

    Posted 17 Dec 2007 Link to this post

    Hi Robert Graff,

    Yes, this is our latest version. We will release an official one in two days.

    Other suggestion is to register the asp.net ajax extensions like in the following article:
    http://asp.net/ajax/documentation/live/ConfiguringASPNETAJAX.aspx

    If you have a problem with RadColorPicker after that, please create a simple running project and send it to us



    Regards,
    Petio Petkov
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center

  6. Robert Graff
    Robert Graff avatar
    34 posts
    Member since:
    Jun 2007

    Posted 18 Jan 2008 Link to this post

    Hello, I've uploaded a sample app:

    http://www.sendspace.com/file/42hp7q

    It's basically a blank project, in which I've dragged a script manager and radColourPicker control onto the form.

    ...but it doesn't work.. What am I doing wrong? It's probably something really simple.

    Thanks in advance.

  7. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts
    Member since:
    Sep 2012

    Posted 21 Jan 2008 Link to this post

    Hi Robert,

    I downloaded your project and tested it. I noticed that it is not an AJAXEnabledWebSite. When you create such a WebSite, VS.NET adds a lot of additional stuff to your web.config file, which might be required, and your web.config file didn't include it. I created a new blank AJAXEnabledWebSite and copied its web.config file's content to your project's web.config file and it worked. So I can suggest you to edit your web.config file in the same manner or to implement a new  AJAXEnabledWebSite.

    Sincerely yours,
    Svetlina
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center

  8. Robert Graff
    Robert Graff avatar
    34 posts
    Member since:
    Jun 2007

    Posted 23 Jan 2008 Link to this post

    That was it!

    The site was not an Ajax-Enabled site; I did exactly what you suggested, and udpated my Web.Config file accordingly and now it works, thank you!

Back to Top