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

Tooltipified RadGrid - tool tip is empty

3 Answers 87 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 1
Roland asked on 27 Sep 2010, 10:24 PM
Hello,
 i'm implementing the Tooltipified RadGrid on my sharepoint site. I've followed all the instructions on the demo.
Upon mouseover on my radgrid, my tool tip pops-up but it's empty(no content).

I'm using this example: http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx

when I step through the code,  the user control for the tooltip is present and I can view the text attribute of the control.
 
 I also stripped down the user control  page to a bare minimum to  just one label control but I had no success.
 At this point I don't know what's  causing the tool tip to be blank. 
  
 After a few mouseovers on the radgrid items, I get the following error:
-------------
Windows Internet Explorer

Stop running this script?

A script on this page is causing Internet Explorer to run slowly.
If it continues to run, your computer might become
unresponsive.
-----------


ASPX CODE:
<%@ Register Src="ActivityDetails.ascx" TagName="ActivityDetails" TagPrefix="actDetails" %>
 
 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
     
   <telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="ManualClose"
        Width="250" Height="350" runat="server" EnableShadow="true" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Element"
        Position="MiddleRight">
    </telerik:RadToolTipManager>
 
   <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgCampaigns">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgCampaigns" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>



C# Code:
protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
        {
            this.UpdateToolTip(args.Value, args.UpdatePanel);
        }
        private void UpdateToolTip(string ActivityCode, UpdatePanel panel)
        {
            Control ctrl = Page.LoadControl("/_controltemplates/WP_Campaigns/ActivityDetails.ascx");
            panel.ContentTemplateContainer.Controls.Add(ctrl);
                         
            ActivityDetails details = (ActivityDetails)ctrl;
            details.ActivityCode = ActivityCode;
          
        }
 
protected void rgCampaigns_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
         
                        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
                        {
                            Control target = e.Item.FindControl("lblTitle");
                            if (!Object.Equals(target, null))
                            {
                                if (!Object.Equals(this.RadToolTipManager1, null))
                                {
                                    //Add the button (target) id to the tooltip manager
                                    this.RadToolTipManager1.TargetControls.Add(target.ClientID, (e.Item as GridDataItem).GetDataKeyValue("GlobalCode").ToString(), true);
 
                                }
                            }
                        }
 
                    
        }
reciated:

USER Control ASPX page:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ActivityDetails.ascx.cs"
    Inherits="Cosmos3.WebPages.ActivityDetails, Cosmos3.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5f15fbcafb2bcb72" %>
<asp:Label ID="lbltest" runat="server" Text="Label"></asp:Label>


USER Control C# page:
namespace Cosmos3.WebPages
{
    public partial class ActivityDetails : System.Web.UI.UserControl
    {
 
        public string ActivityCode
        {
            get
            {
                if (ViewState["ActivityCode"] == null)
                {
                    return "";
                }
                return (string)ViewState["ActivityCode"];
            }
            set
            {
 
                ViewState["ActivityCode"] = value;
 
            }
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
 
            lbltest.Text += "<br>Activity code: "+ActivityCode;
            
        }
    }
}


your help is highly appreciated.
Thank you.
-roland




3 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 30 Sep 2010, 01:52 PM
Hi Roland,

 I built up a test demo based on your code but unfortunately to no avail - it is working fine on my side. The only thing I can assume is that you have not provided the correct virtual path when loading the control. Would you please try a virtual path with tilde (~) for the root similarly to:

Control ctrl = Page.LoadControl("~/_controltemplates/WP_Campaigns/ActivityDetails.ascx");

More information about the LoadControl method is available below:

http://msdn.microsoft.com/en-us/library/t9ecy7tf.aspx

If this is not the case, please examine my test demo which I attached for your reference and let me know what changes I should apply to reproduce the problem. Once I am able to observe the issue on my side I will do my best to help.

Kind regards,
Svetlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Gulfam
Top achievements
Rank 1
answered on 31 Jan 2011, 04:29 PM
Hello Svetlina,

I'm trying to implement the Tooltipified RadGrid in my web user control. I've followed all the instructions  according to your attached file telerikradtooltipsample.zipUpon mouseover on my radgrid, my tool tip doesn't pops-up.

I'm also using this example: http://demos.telerik.com/aspnet-ajax/tooltip/examples/targetcontrolsandajax/defaultcs.aspx

I had no success. I don't know what is the reason, why the tool tip isn't populating.

ASPX Code:
<%@ Control language="C#" Inherits="SU_SaleStatisticImport.EditSU_SaleStatisticImport" AutoEventWireup="true" Codebehind="EditSU_SaleStatisticImport.ascx.cs" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="ActivityDetails.ascx" TagName="ActivityDetails" TagPrefix="uc1" %>
     
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="btnSavedAll">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="btnSavedAll" LoadingPanelID="RadAjaxLoadingPanel1"
                    UpdatePanelRenderMode="Inline" />
                <telerik:AjaxUpdatedControl ControlID="RadAjaxPanelEdit" />
                <telerik:AjaxUpdatedControl ControlID="imgSavedAll" UpdatePanelRenderMode="Inline" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="grd_EditSales">
            <UpdatedControls>
                 <%--<telerik:AjaxUpdatedControl ControlID="RadAjaxPanelCreated" />--%>
                 <telerik:AjaxUpdatedControl ControlID="grd_EditSales" LoadingPanelID="RadAjaxLoadingPanel1" />
                 <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="cmb_Period">
            <UpdatedControls>
                 <telerik:AjaxUpdatedControl ControlID="RadAjaxPanelCreated" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" EnableSkinTransparency="true"
    runat="server" HorizontalAlign="Center">
    <div class="loading">
        <asp:Image ID="Image7" runat="server" ImageUrl="~/images/loading8.gif" AlternateText="loading" />
    </div>
</telerik:RadAjaxLoadingPanel>
<telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent="ManualClose"
        Width="250" Height="350" runat="server" EnableShadow="true" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Element"
        Position="MiddleRight">
</telerik:RadToolTipManager>
            <telerik:RadAjaxPanel ID="RadAjaxPanelEdit" LoadingPanelID="RadAjaxLoadingPanel2" EnableAJAX="true" runat="server" Width="100%"
    <table width="100%">
        <tr>
            <td>
            <table width="100%">
 
            <tr >
              
                    <td  Width="20px">
                    Ã…r:
                    </td>
                        <td Width="150px" align="lfft">
                         
                            <telerik:RadComboBox id="cmb_Year" Runat="server" DataTextField="Year"
                                DataValueField="Year_ID" AutoPostBack="True"
                                onselectedindexchanged="cmb_Year_SelectedIndexChanged">
                            </telerik:RadComboBox>
                             
                        </td>
                         <td  Width="50px">
                    Kvartal:
                    </td>
                        <td Width="150px" align="lfft">
                        <telerik:RadComboBox id="cmb_Period" Runat="server" DataTextField="PeriodName"
                                DataValueField="Period_ID" AutoPostBack="True"
                                onselectedindexchanged="cmb_Period_SelectedIndexChanged">
                            </telerik:RadComboBox>
                        </td>
                 
            <td align="right">
             <asp:Image ID="imgSavedAll" runat="server" Visible="false" ImageUrl="~/images/OK32.png">
                        </asp:Image>
                         <asp:ImageButton ID="btnSavedAll" runat="server" ImageUrl="~/images/Save32.png"
                                ToolTip="Spara" OnClick="btnSavedAll_Click" />
            </td>
            </tr>
            </table>
                
            </td>
        </tr>
        <tr>
            <td>
 
                <telerik:RadGrid ID="grd_EditSales" EnableAJAX="True" AllowMultiRowSelection="True"
                    ShowStatusBar="True" GridLines="None"  AllowSorting="True"
                    runat="server" AllowPaging="True" AutoGenerateColumns="False" OnItemCommand="grd_EditSales_ItemCommand"
                    OnNeedDataSource="grd_EditSales_NeedDataSource" ShowGroupPanel="True" OnItemDataBound="grd_EditSales_ItemDataBound">
                     <grouppanel text="Dra en kolumnrubrik och släpp den här gruppen efter den kolumnen">
                    </grouppanel>
                    <ClientSettings EnableRowHoverStyle="true" allowdragtogroup="True">
                        <Selecting AllowRowSelect="true" />
                    </ClientSettings>
                    <MasterTableView Width="100%" DataKeyNames="Sale_ID" HorizontalAlign="NotSet" AutoGenerateColumns="False" allowmulticolumnsorting="True" CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst" Dir="LTR" Frame="Border" TableLayout="Auto">
                        <Columns>
                                                 
                        <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
                                    <HeaderStyle Width="24px" />
                                </telerik:GridClientSelectColumn>
                        <telerik:GridTemplateColumn UniqueName="imgStatus">
                                    <ItemTemplate>
                                        <asp:Image ID="ImgIconStatus" runat="server"
                                            ImageUrl='<%# Eval("iconStatus_fk","~/images/{0}.gif") %>'
                                            Visible="true" />
                                    </ItemTemplate>
                                    <HeaderStyle Width="24px" />
                         </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="Sale_ID" DataType="System.Int32" HeaderText="Sale_ID"
                                Visible="false" UniqueName="Sale_ID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="Period_ID" Visible="false" />
                            <telerik:GridBoundColumn DataField="Company_ID" Visible="false" />
                            <telerik:GridBoundColumn DataField="CompanyHasPeriod_ID" Visible="false" />
                            <Telerik:GridTemplateColumn HeaderText="First">
                                <ItemTemplate>
                                    <asp:Label ID="lblTitle" runat="server" Text="Show ToolTip"></asp:Label>
                                </ItemTemplate>
                            </Telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="SupplierNo" HeaderText="Lev. Nr" UniqueName="SupplierNo">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="SupplierName" HeaderText="Leverantör" UniqueName="SupplierName">
                            </telerik:GridBoundColumn>
                            <%--<telerik:GridTemplateColumn HeaderText="Leverantör" SortExpression="SupplierName">
                                <ItemTemplate>
                                    <asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text='<%# Eval("SupplierName") %>'></asp:HyperLink>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>--%>
                               
                              <telerik:GridBoundColumn DataField="CompanyNo" HeaderText="För. Nr" UniqueName="CompanyNo">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CompanyName" HeaderText="Företag" UniqueName="CompanyName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="PeriodName" HeaderText="Period" UniqueName="PeriodName">
                            </telerik:GridBoundColumn>
 
                                   <telerik:GridBoundColumn DataField="SupplierCustomerNo" HeaderText="Lev. Kund Nr" UniqueName="SupplierCustomerNo">
                            </telerik:GridBoundColumn>
                             <telerik:GridTemplateColumn HeaderText="Leverantör Kund Nr" UniqueName="SupplierCustomerNo" visible="false">
                                    <ItemTemplate>
                                    <telerik:RadTextBox ID="txtSupplierCustomerNo"  Width="50px" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"SupplierCustomerNo") %>'>
                                    </telerik:RadTextBox>
                                    <asp:Image ID="ImgNoSaved" runat="server" Visible="false">
                                    </asp:Image>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Belopp" UniqueName="Amount">
                                <ItemTemplate>
                                    <telerik:RadNumericTextBox ID="txtAmount"  Width="70px" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"Amount") %>'
                                        Value="0" MaxLength="12">
                                        <EnabledStyle HorizontalAlign="Right" />
                                    </telerik:RadNumericTextBox>
                                    <asp:Image ID="ImgSaved" runat="server" Visible="false">
                                    </asp:Image>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                                  <telerik:GridTemplateColumn HeaderText="Pri Belopp" UniqueName="PriAmount">
                                <ItemTemplate>
                                    <telerik:RadNumericTextBox ID="txtPriAmount"  Width="70px" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"PriAmount") %>'
                                        Value="0" MaxLength="12">
                                           <EnabledStyle HorizontalAlign="Right" />
                                    </telerik:RadNumericTextBox>
                                    <asp:Image ID="ImgPriSaved" runat="server" Visible="false">
                                    </asp:Image>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Not" UniqueName="Note">
                                <ItemTemplate>
                                    <telerik:RadTextBox ID="txtNote" runat="server" Width="150px" Text='<%# DataBinder.Eval(Container.DataItem,"Note") %>'
                                        MaxLength="450">
                                    </telerik:RadTextBox>
                                    <asp:Image ID="ImgNoteSaved" runat="server" Visible="false">
                                    </asp:Image>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn HeaderText="Status" UniqueName="Status">
                                <ItemTemplate>
                                        <telerik:RadComboBox ID="StatusComboBox" runat="server" width="60px" SelectedValue='<%# Eval("Status_fk") %>'>
                                            <Items>
                                                <telerik:RadComboBoxItem runat="server" Text="LÃ¥s" Value="1" />
                                               <telerik:RadComboBoxItem runat="server" Text="LÃ¥s upp" Value="4" />
                                                 
                                            </Items>
                                        </telerik:RadComboBox>
                                        <asp:Image ID="ImgStatusSaved" runat="server" Visible="false">
                                        </asp:Image>
                            </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Save"
                                    ImageUrl="~/images/Save16.png"  Text="Spara" UniqueName="colbtnSave">
                                    <HeaderStyle Width="24px" />
                                </telerik:GridButtonColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
                 
 
            </td>
        </tr>
        </table>
 
 </telerik:RadAjaxPanel>
 
 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Default">
 
</telerik:RadAjaxLoadingPanel>
 <%--</form>
</body>
</html>--%>


C# Code:
/*
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2006
' by Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
 */
 
using System;
 
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using Telerik.Web.UI;
using System.Data;
using SaleStatisticImport;
using Bonus;
using CommonControls;
 
namespace SU_SaleStatisticImport
{
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// The EditSU_SaleStatisticImport class is used to manage content
    /// </summary>
    /// <remarks>
    /// </remarks>
    /// <history>
    /// </history>
    /// -----------------------------------------------------------------------------
    partial class EditSU_SaleStatisticImport : PortalModuleBase
    {
        #region Private Members
        static int Company_ID;
        #endregion
 
        #region Starting Routines
 
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind_Year();
                Company_ID = Supplier_ID();
            }
 
        }
 
        #endregion
 
        #region content methods
        private void BindData(int Supplier_ID, int Year_ID, int Period_ID, string Data)
        {
            SaleStatisticImportController objSaleStatisticImportController = new SaleStatisticImportController();
            grd_EditSales.DataSource = objSaleStatisticImportController.GetSaleStatisticImports(Company_ID, Year_ID, Period_ID, "Created");
        }
 
        private void Bind_Year()
        {
            YearController objYearController = new YearController();
            cmb_Year.DataSource = objYearController.GetYearAll();
            cmb_Year.DataBind();
        }
 
        private void Bind_PeriodByYear(int Year_ID)
        {
            CommonControls.PeriodController objPeriodController = new CommonControls.PeriodController();
            cmb_Period.DataSource = objPeriodController.GetPeriodByYearAll(Year_ID);
            cmb_Period.DataBind();
        }
        private int Supplier_ID()
        {
            //BonusController myBonusCtrl = new BonusController();
            //return myBonusCtrl.companyID(this.UserInfo.UserID);
            return 239;
        }
        private void SaveSupplierCustomerNo(int Supplier_ID, int Member_ID, string SupplierCustomerNo)
        {
            SupplierCustomerNoController objSupplierCustomerNoController = new SupplierCustomerNoController();
            SupplierCustomerNoInfo objSupplierCustomerNoInfo = new SupplierCustomerNoInfo();
            List<SupplierCustomerNoInfo> objSupplierCustomerNoList = new List<SupplierCustomerNoInfo>();
            objSupplierCustomerNoList = objSupplierCustomerNoController.GetSupplierCustomerNo(Supplier_ID, Member_ID);
            string no = "";
            if (objSupplierCustomerNoList.Count > 0)
            {
                no = objSupplierCustomerNoController.GetSupplierCustomerNo(Supplier_ID, Member_ID)[0].SupplierCustomerNo;
            }
            objSupplierCustomerNoInfo.Supplier_fk = Supplier_ID;
            objSupplierCustomerNoInfo.Member_fk = Member_ID;
            objSupplierCustomerNoInfo.SupplierCustomerNo = SupplierCustomerNo;
            if (string.IsNullOrEmpty(no))
            {
                objSupplierCustomerNoController.AddSupplierCustomerNo(objSupplierCustomerNoInfo);
            }
            else
            {
                objSupplierCustomerNoController.UpdateSupplierCustomerNo(objSupplierCustomerNoInfo);
            }
 
        }
 
        protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args)
        {
            this.UpdateToolTip(args.Value, args.UpdatePanel);
        }
        private void UpdateToolTip(string elementID, UpdatePanel panel)
        {
            Control ctrl = Page.LoadControl("~/ActivityDetails.ascx");
            panel.ContentTemplateContainer.Controls.Add(ctrl);
            ActivityDetails details = (ActivityDetails)ctrl;
            details.ActivityCode = elementID;
        }
 
        #endregion
 
        #region Grid Methods
        protected void grd_EditSales_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            //if (e.CommandName == "Lock")
            //{
            //    SaleStatisticImportController objSaleStatisticImportControllerUnlock = new SaleStatisticImportController();
            //    SaleStatisticImportInfo objSaleStatisticImportInfoUnlock = new SaleStatisticImportInfo();
 
            //    int Sale_ID = Convert.ToInt32(this.grd_EditSales.Items[e.Item.ItemIndex]["Sale_ID"].Text);
            //    int Status_fk = 4; // 4 is assigned as a unlock value for Status_fk
            //    objSaleStatisticImportInfoUnlock.Sale_ID = Sale_ID;
            //    objSaleStatisticImportInfoUnlock.Status_fk = Status_fk;
 
            //    try
            //    {
            //        //SaveSupplierCustomerNo(Company_ID, objSaleStatisticImportInfo.MemberCompany_fk, SupplierCustomerNo);
            //        objSaleStatisticImportControllerUnlock.UpdateSaleStatisticImport_Status(objSaleStatisticImportInfoUnlock.Sale_ID, objSaleStatisticImportInfoUnlock.Status_fk);
 
                                        
            //    }
            //    catch (Exception)
            //    {
            //        //(e.Item.FindControl("ImgNoteSaved") as Image).Visible = true;
            //        //(e.Item.FindControl("ImgNoteSaved") as Image).ImageUrl = "~/images/deny.gif";
            //    }
            //}
            if (e.CommandName == "Save")
            {
                //SaleStatisticImportController objSaleStatisticImportControllerUnlock = new SaleStatisticImportController();
                //SaleStatisticImportInfo objSaleStatisticImportInfoUnlock = new SaleStatisticImportInfo();
 
                //int Sale_ID = Convert.ToInt32(this.grd_EditSales.Items[e.Item.ItemIndex]["Sale_ID"].Text);
                //int Status_fk = 4; // 4 is assigned as a unlock value for Status_fk
                //objSaleStatisticImportInfoUnlock.Sale_ID = Sale_ID;
                //objSaleStatisticImportInfoUnlock.Status_fk = Status_fk;
                SaleStatisticImportController objSaleStatisticImportController = new SaleStatisticImportController();
                SaleStatisticImportInfo objSaleStatisticImportInfo = new SaleStatisticImportInfo();
 
                int Sale_ID = Convert.ToInt32(this.grd_EditSales.Items[e.Item.ItemIndex]["Sale_ID"].Text);
                string SupplierCustomerNo = (e.Item.FindControl("txtSupplierCustomerNo") as RadTextBox).Text;
                double Amount = Convert.ToInt32((e.Item.FindControl("txtAmount") as RadNumericTextBox).Text);
                double PriAmount = Convert.ToInt32((e.Item.FindControl("txtPriAmount") as RadNumericTextBox).Text);
                string Note = (e.Item.FindControl("txtNote") as RadTextBox).Text;
                int Status_fk = Convert.ToInt32((e.Item.FindControl("StatusComboBox") as RadComboBox).SelectedValue);
                if ((Amount != 0.0) && !string.IsNullOrEmpty(Amount.ToString()))
                {
                    objSaleStatisticImportInfo.Sale_ID = Sale_ID;
                    objSaleStatisticImportInfo.SupplierCustomerNo = SupplierCustomerNo;
                    objSaleStatisticImportInfo.CompanyHasPeriod_fk = Convert.ToInt32(this.grd_EditSales.Items[e.Item.ItemIndex]["CompanyHasPeriod_ID"].Text);
                    objSaleStatisticImportInfo.MemberCompany_fk = Convert.ToInt32(this.grd_EditSales.Items[e.Item.ItemIndex]["Company_ID"].Text);
                    objSaleStatisticImportInfo.Amount = Amount;
                    objSaleStatisticImportInfo.PriAmount = PriAmount;
                    objSaleStatisticImportInfo.ChangedBy = this.UserInfo.Username;
                    objSaleStatisticImportInfo.Note = Note;
                    objSaleStatisticImportInfo.Status_fk = Status_fk;
                     
 
                    try
                    {
                         
                        SaveSupplierCustomerNo(Company_ID, objSaleStatisticImportInfo.MemberCompany_fk, SupplierCustomerNo);
                        objSaleStatisticImportController.UpdateSaleStatisticImport(objSaleStatisticImportInfo);
                         
                        (e.Item.FindControl("ImgNoSaved") as Image).Visible = true;
                        (e.Item.FindControl("ImgNoSaved") as Image).ImageUrl = "~/images/grant.gif";
                        (e.Item.FindControl("ImgSaved") as Image).Visible = true;
                        (e.Item.FindControl("ImgSaved") as Image).ImageUrl = "~/images/grant.gif";
                        (e.Item.FindControl("ImgPriSaved") as Image).Visible = true;
                        (e.Item.FindControl("ImgPriSaved") as Image).ImageUrl = "~/images/grant.gif";
                        (e.Item.FindControl("ImgNoteSaved") as Image).Visible = true;
                        (e.Item.FindControl("ImgNoteSaved") as Image).ImageUrl = "~/images/grant.gif";
                        if (Status_fk == 1)
                        {
                            (e.Item.FindControl("ImgStatusSaved") as Image).Visible = true;
                            (e.Item.FindControl("ImgStatusSaved") as Image).ImageUrl = "~/images/icon_lock.gif";
                            (e.Item.FindControl("ImgIconStatus") as Image).Visible = true;
                            (e.Item.FindControl("ImgIconStatus") as Image).ImageUrl = "~/images/icon_lock.gif";
                        }
                        else
                        {
                            (e.Item.FindControl("ImgStatusSaved") as Image).Visible = true;
                            (e.Item.FindControl("ImgStatusSaved") as Image).ImageUrl = "~/images/icon_unlock.gif";
                            (e.Item.FindControl("ImgIconStatus") as Image).Visible = true;
                            (e.Item.FindControl("ImgIconStatus") as Image).ImageUrl = "~/images/icon_unlock.gif";
                        }
 
                        (e.Item.FindControl("txtNote") as RadTextBox).Enabled = false;
                        (e.Item.FindControl("txtSupplierCustomerNo") as RadTextBox).Enabled = false;
                        (e.Item.FindControl("txtAmount") as RadNumericTextBox).Enabled = false;
                        (e.Item.FindControl("txtPriAmount") as RadNumericTextBox).Enabled = false;
                        (e.Item.FindControl("StatusComboBox") as RadComboBox).Enabled = false;
                        this.grd_EditSales.Items[e.Item.ItemIndex]["colbtnSave"].Enabled = false;
                    }
                    catch (Exception)
                    {
                        (e.Item.FindControl("ImgNoSaved") as Image).Visible = true;
                        (e.Item.FindControl("ImgNoSaved") as Image).ImageUrl = "~/images/deny.gif";
                        (e.Item.FindControl("ImgSaved") as Image).Visible = true;
                        (e.Item.FindControl("ImgSaved") as Image).ImageUrl = "~/images/deny.gif";
                        (e.Item.FindControl("ImgPriSaved") as Image).Visible = true;
                        (e.Item.FindControl("ImgPriSaved") as Image).ImageUrl = "~/images/deny.gif";
                        (e.Item.FindControl("ImgNoteSaved") as Image).Visible = true;
                        (e.Item.FindControl("ImgNoteSaved") as Image).ImageUrl = "~/images/deny.gif";
                        (e.Item.FindControl("ImgStatusSaved") as Image).Visible = true;
                        (e.Item.FindControl("ImgStatusSaved") as Image).ImageUrl = "~/images/deny.gif";
                        (e.Item.FindControl("ImgIconStatus") as Image).Visible = true;
                        (e.Item.FindControl("ImgIconStatus") as Image).ImageUrl = "~/images/deny.gif";
                        // Exceptions.ProcessModuleLoadException(this, exc);
                    }
                }
            }
 
            if (e.CommandName == "Sort" || e.CommandName == "Page")
            {
                RadToolTipManager1.TargetControls.Clear();
            }
        }
        protected void grd_EditSales_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            int YID = Convert.ToInt32(cmb_Year.SelectedValue); // * Get Selected Year ID
            int PID=Convert.ToInt32((!string.IsNullOrEmpty(cmb_Period.SelectedValue)?cmb_Period.SelectedValue:"-1")); // * Get Selected period ID
             
            BindData(Supplier_ID(), YID, PID, "Created");
            //SaleStatisticImportController objSaleStatisticImportController = new SaleStatisticImportController();
            //grd_EditSales.DataSource = objSaleStatisticImportController.GetSaleStatisticImports(Company_ID,-1,-1,"Created");
            
        }
        protected void grd_EditSales_ItemDataBound(object sender, GridItemEventArgs e)
        {
 
            if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
            {
                Control target = e.Item.FindControl("lblTitle");
                if (!Object.Equals(target, null))
                {
                    if (!Object.Equals(this.RadToolTipManager1, null))
                    {
                        //Add the button (target) id to the tooltip manager
                        this.RadToolTipManager1.TargetControls.Add(target.ClientID, (e.Item as GridDataItem).GetDataKeyValue("Sale_ID").ToString(), true);
 
                    }
                }
            }
 
        }
      
        #endregion
 
        #region User Events
 
        protected void btnSavedAll_Click(object sender, ImageClickEventArgs e)
        {
            foreach (GridDataItem rowitems in grd_EditSales.SelectedItems)
            {
                SaleStatisticImportController objSaleStatisticImportController = new SaleStatisticImportController();
                SaleStatisticImportInfo objSaleStatisticImportInfo = new SaleStatisticImportInfo();
                double Amount = Convert.ToInt32((rowitems.FindControl("txtAmount") as RadNumericTextBox).Text);
                double PriAmount = Convert.ToInt32((rowitems.FindControl("txtPriAmount") as RadNumericTextBox).Text);
                string Note = (rowitems.FindControl("txtNote") as RadTextBox).Text;
                int Status_fk = Convert.ToInt32((rowitems.FindControl("StatusComboBox") as RadComboBox).SelectedValue);
                if ((Amount != 0.0) && !string.IsNullOrEmpty(Amount.ToString()))
                {
                    objSaleStatisticImportInfo.Sale_ID = Convert.ToInt32(this.grd_EditSales.Items[rowitems.ItemIndex]["Sale_ID"].Text);
                    objSaleStatisticImportInfo.SupplierCustomerNo = this.grd_EditSales.Items[rowitems.ItemIndex]["SupplierCustomerNo"].Text;
                    objSaleStatisticImportInfo.CompanyHasPeriod_fk = Convert.ToInt32(this.grd_EditSales.Items[rowitems.ItemIndex]["CompanyHasPeriod_ID"].Text);
                    objSaleStatisticImportInfo.MemberCompany_fk = Convert.ToInt32(this.grd_EditSales.Items[rowitems.ItemIndex]["Company_ID"].Text);
                    objSaleStatisticImportInfo.Amount = Amount;
                    objSaleStatisticImportInfo.PriAmount = PriAmount;
                    objSaleStatisticImportInfo.ChangedBy = this.UserInfo.Username;
                    objSaleStatisticImportInfo.Note = Note;
                    objSaleStatisticImportInfo.Status_fk = Status_fk;
                    try
                    {
                        imgSavedAll.Visible = true;
                        SaveSupplierCustomerNo(Company_ID, objSaleStatisticImportInfo.MemberCompany_fk, objSaleStatisticImportInfo.SupplierCustomerNo);
                        objSaleStatisticImportController.UpdateSaleStatisticImport(objSaleStatisticImportInfo);
                         
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgSaved") as Image).Visible = true;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgSaved") as Image).ImageUrl = "~/images/grant.gif";
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgPriSaved") as Image).Visible = true;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgPriSaved") as Image).ImageUrl = "~/images/grant.gif";
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgNoSaved") as Image).Visible = true;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgNoSaved") as Image).ImageUrl = "~/images/grant.gif";
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgNoteSaved") as Image).Visible = true;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgNoteSaved") as Image).ImageUrl = "~/images/grant.gif";
                        if (Status_fk == 1)
                        {
                            (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgStatusSaved") as Image).Visible = true;
                            (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgStatusSaved") as Image).ImageUrl = "~/images/icon_lock.gif";
                            (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgIconStatus") as Image).Visible = true;
                            (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgIconStatus") as Image).ImageUrl = "~/images/icon_lock.gif";
                        }
                        else
                        {
                            (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgStatusSaved") as Image).Visible = true;
                            (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgStatusSaved") as Image).ImageUrl = "~/images/icon_unlock.gif";
                            (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgIconStatus") as Image).Visible = true;
                            (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgIconStatus") as Image).ImageUrl = "~/images/icon_unlock.gif";
                        }
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("txtNote") as RadTextBox).Enabled = false;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("txtSupplierCustomerNo") as RadTextBox).Enabled = false;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("txtAmount") as RadNumericTextBox).Enabled = false;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("txtPriAmount") as RadNumericTextBox).Enabled = false;
                        this.grd_EditSales.Items[rowitems.ItemIndex]["colbtnSave"].Enabled = false;
                    }
                    catch (Exception)
                    {
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgSaved") as Image).Visible = true;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgSaved") as Image).ImageUrl = "~/images/deny.gif";
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgPriSaved") as Image).Visible = true;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgPriSaved") as Image).ImageUrl = "~/images/deny.gif";
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgNoSaved") as Image).Visible = true;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgNoSaved") as Image).ImageUrl = "~/images/deny.gif";
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgStatusSaved") as Image).Visible = true;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgStatusSaved") as Image).ImageUrl = "~/images/deny.gif";
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgIconStatus") as Image).Visible = true;
                        (this.grd_EditSales.Items[rowitems.ItemIndex].FindControl("ImgIconStatus") as Image).ImageUrl = "~/images/deny.gif";
                        //Exceptions.ProcessModuleLoadException(this, exc);
                    }
                }
            }
        }
        protected void cmb_Year_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            Bind_PeriodByYear(string.IsNullOrEmpty(cmb_Year.SelectedValue.ToString()) ? 0 : Convert.ToInt32(cmb_Year.SelectedValue));
            int PID = Convert.ToInt32((!string.IsNullOrEmpty(cmb_Period.SelectedValue) ? cmb_Period.SelectedValue : "-1"));
            BindData(Supplier_ID(), string.IsNullOrEmpty(cmb_Year.SelectedValue.ToString()) ? 0 : Convert.ToInt32(cmb_Year.SelectedValue), string.IsNullOrEmpty(cmb_Period.SelectedValue.ToString()) ? 0 : Convert.ToInt32(cmb_Period.SelectedValue), "Created");
 
        }
        protected void cmb_Period_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            BindData(Supplier_ID(), string.IsNullOrEmpty(cmb_Year.SelectedValue.ToString()) ? 0 : Convert.ToInt32(cmb_Year.SelectedValue), string.IsNullOrEmpty(cmb_Period.SelectedValue.ToString()) ? 0 : Convert.ToInt32(cmb_Period.SelectedValue), "Created");
            grd_EditSales.Rebind();
        }
        #endregion
    }
}

USER Control ASPX page:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ActivityDetails.ascx.cs" Inherits="SU_SaleStatisticImport.ActivityDetails" %>
<asp:label id="lbltest" runat="server" text="Label"></asp:label>

USER Control C# page:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace SU_SaleStatisticImport
{
    public partial class ActivityDetails : System.Web.UI.UserControl
    {
        public string ActivityCode
        {
            get
            {
                if (ViewState["ActivityCode"] == null)
                {
                    return "";
                }
                return (string)ViewState["ActivityCode"];
            }
            set
            {
 
                ViewState["ActivityCode"] = value;
 
            }
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            lbltest.Text += "<br>Activity code: " + ActivityCode;
        }
    }
}


0
Svetlina Anati
Telerik team
answered on 03 Feb 2011, 10:38 AM
Hello Gulfam,

 I am afraid that I cannot tell what is the problem without debugging your code. Please, modify it in order to be fully runnable sample and attach it here (do not include the Telerik.Web.UI.dll but include everything else which is needed, e.g you can directly modify my sample). Once I have a runnable sample which I can debug, I will do my best to help.

All the best,
Svetlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
ToolTip
Asked by
Roland
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Gulfam
Top achievements
Rank 1
Share this question
or