Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
129 views
Hi All

when user on mouseover of the +/- icons i need to Expand/Collapse tree nodes at client side.


Thanks
Sree
Shree
Top achievements
Rank 1
 answered on 11 Aug 2014
4 answers
260 views
Hi,

I have a web form with Master page enabled in it. The web form has list of search criteria (Telerik controls only) and choosing them and giving a search gives the results in the RadGrid (This grid has Export to Excel & Export to CSV enabled). What happens is, when the page is loaded the grid is displayed without any data (I am simply binding to RadGridActiveInquiry.DataSource = new object[] { };

But what happens is, if  click on Export to Excel or Export to CSV, the excel is opened with data though the grid is not bound to the same data. I am not sure how it is happening. I have put break point and was debugging. As soon as I click on the CSV / Excel icon at the top right of the grid, it is loading the data. If I give normal search based on the filter criteria and fire CSV / Excel the fitlered data gets populated in the excel. In the first load of the page it self the CSV & Excel export is not working as expected. 

I have given my code below.

<%@ Page Title="" Language="C#" MasterPageFile="~/Templates/OneColumn.Master" AutoEventWireup="true"
    CodeBehind="ActiveInquiry.aspx.cs" Inherits="ABS2.Customer.ActiveInquiry" ValidateRequest="false" ClientIDMode="AutoID" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../CSS/CustomerActionMenu.css" rel="stylesheet" type="text/css" />

    <telerik:radscriptblock id="RadScriptBlockActiveInquiry" runat="server">
<script type="text/javascript">
   ActiveInquiry = {
openStatusChangePopup: function () {
           var selectedIDs = GetSelectedIDs();
           PopupWindow.open('/customer/popups/CustomerStatusChangeDialog.aspx?CustIDS=' + selectedIDs, 700, 600, ActiveInquiry.refreshGrid);
           return false;
       },
openCopyPopup: function () {
           var selectedIDs = GetSelectedIDs();
           PopupWindow.open('/Customer/Popups/CustomerCopy.aspx?CustIDS=' + selectedIDs, 700, 600);
           return false;
       },
openTransferPopup: function () {
           var selectedIDs = GetSelectedIDs();
           PopupWindow.open('/Customer/Popups/CustomerTransfer.aspx?CustIDS=' + selectedIDs, 700, 600, ActiveInquiry.refreshGrid);
           return false;
       },
onRequestStart: function (sender, args) {
           if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
               args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
               args.get_eventTarget().indexOf("ExportToCsvButton") >= 0 ||
               args.get_eventTarget().indexOf("ExportToPdfButton") >= 0) {
               args.set_enableAjax(false);
           }
       },
refreshGrid: function () {
           $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("RebindGrid");
       },
    showHideGroupAction: function () {
           var grid = $find("<%=RadGridActiveInquiry.ClientID %>");
           var table = document.getElementById("<%=TableMegaDropdown.ClientID %>");
           var gridSelectedItems = grid.get_masterTableView().get_selectedItems();
           table.style.display = gridSelectedItems.length > 0 ? "block" : "none";
       }
   };

            function ShowSoloForm(id, action) {
                switch (action) {
                    case 'Status':
                        PopupWindow.open('/customer/popups/CustomerStatusChangeDialog.aspx?CustomerID=' + id, 700, 400, ActiveInquiry.refreshGrid);
                        break;
                    case 'Transfer':
                        PopupWindow.open('/Customer/Popups/CustomerTransfer.aspx?CustIDS=' + id, 600, 400, ActiveInquiry.refreshGrid);
                        break;
                    case 'Copy':
                        PopupWindow.open('/Customer/Popups/CustomerCopy.aspx?CustIDS=' + id, 700, 400);
                        break;
                    default:
                        break;
                }

                return false;
   }

   function GetSelectedIDs() {
       var selectedIDs = '';
       var selectedItems = $find('<%= RadGridActiveInquiry.ClientID %>').get_masterTableView().get_selectedItems();
for (var ii = 0; ii < selectedItems.length; ii++) {
   selectedIDs += (selectedIDs.length > 0 ? ',' : '') + selectedItems[ii].getDataKeyValue('CustomerId');
            }
return selectedIDs;
            }

            function RadMenuCloseOnClicked() {
                var menu = $find("<%=RadMenuActionMenu.ClientID %>");
                menu.close();
            }

   function CloseRadToolTip(toolTip) {
       var radToolTip = $find(toolTip);
       if (radToolTip.isVisible()) {
           radToolTip.hide();
       }
   }

   function refreshGrid() {
       $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("RebindGrid");
   }
</script>
</telerik:radscriptblock>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="AN" runat="server">
<table cellpadding="0" cellspacing="0" border="0" style="margin-top: 20px; margin-left: -320px;"
runat="server" id="TableMegaDropdown">
<tr>
<td>
<div id="MegaDropDown">
<script type="text/javascript">
   function itemOpened(s, e) {
       if ($telerik.isIE8) {
           // Fix an IE 8 bug that causes the list bullets to disappear (standards mode only)
           $telerik.$("li", e.get_item().get_element())
                                .each(function () { this.style.cssText = this.style.cssText; });
                            }
                        }
                    </script>
                    <telerik:radmenu runat="server" id="RadMenuActionMenu" onclientitemopened="itemOpened"
                        skin="Sitefinity" enableshadows="false" style="z-index: 2900" collapseanimation-type="None"
                        collapseanimation-duration="0" collapsedelay="0">
<Items>
<telerik:RadMenuItem PostBack="false" Width="125px">
                                 <ItemTemplate>
                                    <div class="fDiv">
                                        <asp:ImageButton ID="btnTest" runat="server" Width="128px" Height="28px" ImageUrl="<%$ Resources:UI, ActiveInquiry_ImageUrl_ImagesButtonActionNoText %>" />
                                        <div class="txtWrap">
                                           <asp:Label ID="Label2" runat="server" Text="<%$ Resources:UI, ActiveInquiry_HTML_ActionMenu %>"></asp:Label> 
                                        </div>
                                    </div>
                                </ItemTemplate>
<Items>
<telerik:RadMenuItem CssClass="Events" Width="440px">
<ItemTemplate>
<div id="EventWrapper" class="Wrapper">
<h3>
<asp:placeholder ID="Placeholder1" runat="server"><%= Resources.UI.ActiveInquiry_HTML_GroupActions %></asp:placeholder></h3>
<div class="newsLeft">
    <asp:LinkButton ID="LinkButtonTransfer" runat="server" OnClientClick="RadMenuCloseOnClicked(); return ActiveInquiry.openTransferPopup();"
                                                        Text="<%$ Resources:UI, ActiveInquiry_Text_TransferInquiries %>" /><br />
                                                    <asp:LinkButton ID="LinkButtonCopy" runat="server" OnClientClick="RadMenuCloseOnClicked(); return ActiveInquiry.openCopyPopup();"
                                                        Text="<%$ Resources:UI, ActiveInquiry_Text_CopyInquiries %>" /><br />
<asp:LinkButton ID="LinkButtonStatus" runat="server" OnClientClick="RadMenuCloseOnClicked(); return ActiveInquiry.openStatusChangePopup();"
                                                        CommandName="Status"><%= Resources.UI.ActiveInquiry_HTML_UpdateStatus %></asp:LinkButton><br />
<asp:Label ID="LabelNoAction" runat="server" Text="" Visible="false" /><br />
<asp:Label ID="LabelNoEmployees" runat="server" Text="" Visible="false" />
<div style="height: 10px;">
</div>
</div>
</div>
</ItemTemplate>
</telerik:RadMenuItem>
</Items>
</telerik:RadMenuItem>
</Items>
</telerik:radmenu>
                </div>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MC" runat="server">
    <div id="divContainer" runat="server">
        <telerik:radajaxmanagerproxy id="RadAjaxManagerProxyCustomerSearch" runat="server">
   <AjaxSettings>
   <telerik:AjaxSetting AjaxControlID="RadButtonSearch">
   <UpdatedControls>
   <telerik:AjaxUpdatedControl ControlID="RadGridActiveInquiry" />
   </UpdatedControls>
   </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGridActiveInquiry">
   <UpdatedControls>
   <telerik:AjaxUpdatedControl ControlID="RadGridActiveInquiry" />
   </UpdatedControls>
   </telerik:AjaxSetting>
   </AjaxSettings>
   </telerik:radajaxmanagerproxy>
        <div style="margin-top: -56px; margin-left: 17px; margin-right: 10px;">
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td>
                        <asp:Label ID="LabelAssignedTo" runat="server" Text="<%$ Resources:UI, ActiveInquiry_Text_LabelAssignedTo %>" SkinID="labelSearchTitle" /><br />
                        <telerik:radcombobox id="RadComboBoxInquiryAssignedTo" runat="server" width="125px" />
                    </td>
                    <td style="width: 5px;" />
                    <td valign="top" align="left">
                        <div>
                            <asp:Label ID="DateFrom" runat="server" Text="<%$ Resources:UI, ActiveInquiry_Text_DateFrom %>" SkinID="labelSearchTitle" />
                        </div>
                        <div>
                            <telerik:raddatepicker id="RadDatePickerFrom" runat="server" mindate="<%$ Resources:UI, ActiveInquiry_MinDate_RadDatePickerFrom %>">
                                <Calendar ID="Calendar2" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="<%$ Resources:UI, ActiveInquiry_ViewSelectorText_Calendar2 %>" runat="server">
                                    <SpecialDays>
                                        <telerik:RadCalendarDay Repeatable="Today" Date="">
                                            <ItemStyle BackColor="#FFFF99" />
                                        </telerik:RadCalendarDay>
                                    </SpecialDays>
                                </Calendar>
                                <DateInput ID="DateInput2" DateFormat="d" DisplayDateFormat="d" Width="" runat="server"></DateInput>                   
                                <DatePopupButton ImageUrl="" HoverImageUrl="" ToolTip="<%$ Resources:UI, ActiveInquiry_DatePopupButton_ToolTip %>"></DatePopupButton>
                                <ShowAnimation Duration="200" />
                            </telerik:raddatepicker>
                        </div>
                    </td>
                    <td valign="top" align="left">
                        <div>
                            <asp:Label ID="DateTo" runat="server" Text="<%$ Resources:UI, ActiveInquiry_Text_DateTo %>" SkinID="labelSearchTitle" />
                        </div>
                        <div>
                            <telerik:raddatepicker id="RadDatePickerTo" runat="server" mindate="<%$ Resources:UI, ActiveInquiry_MinDate_RadDatePickerTo %>">
                                <Calendar ID="Calendar1" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="<%$ Resources:UI, ActiveInquiry_ViewSelectorText_Calendar1 %>" runat="server">
                                    <SpecialDays>
                                        <telerik:RadCalendarDay Repeatable="Today" Date="">
                                            <ItemStyle BackColor="#FFFF99" />
                                        </telerik:RadCalendarDay>
                                    </SpecialDays>
                                </Calendar>
                                <DateInput ID="DateInput1" DateFormat="d" DisplayDateFormat="d" Width="" runat="server"></DateInput>                   
                                <DatePopupButton ImageUrl="" HoverImageUrl="" ToolTip="<%$ Resources:UI, ActiveInquiry_DatePopupButton_ToolTip_1 %>"></DatePopupButton>
                                <ShowAnimation Duration="200" />
                            </telerik:raddatepicker>
                        </div>
                    </td>
                    <td valign="bottom">
                        <telerik:radbutton id="RadButtonSearch" runat="server" image-imageurl="<%$ Resources:UI, ActiveInquiry_ImageUrl_RadButtonSearch %>"
                            causesvalidation="true" width="24px" height="24px" tooltip="<%$ Resources:UI, ActiveInquiry_ToolTip_Search %>" onclick="ImageSearchIcon_Click">
   </telerik:radbutton>
                        <telerik:radbutton id="RadButtonClear" runat="server" image-imageurl="<%$ Resources:UI, ActiveInquiry_ImageUrl_RadButtonClear %>"
                            width="24px" height="24px" tooltip="<%$ Resources:UI, ActiveInquiry_ToolTip_Clear %>" causesvalidation="false" autopostback="true" onclick="ClearForm_Click">
   </telerik:radbutton>
                    </td>
                </tr>
                <tr>
                    <td colspan="2"></td>
                    <td colspan="2" style="height: 14px;">
                        <asp:CompareValidator ID="CVEndDate" runat="server" ControlToCompare="RadDatePickerFrom"
                            ControlToValidate="RadDatePickerTo" ErrorMessage="<%$ Resources:UI, ActiveInquiry_ErrorMessage_EndDateMustBeGreaterThanOrEqualToStartDate %>"
                            ForeColor="Red" Operator="GreaterThanEqual"></asp:CompareValidator>
                    </td>
                </tr>
            </table>
        </div>
        <table style="width: 100%" cellpadding="0" cellspacing="0" border="0" class="leftContentBodyTopBGLG">
            <tr>
                <td>
                    <div id="toppanel">
                        <table cellpadding="0" cellspacing="0" border="0">
                            <tr>
                                <td valign="top">
                                    <div style="margin-left: 15px; margin-right: 15px; margin-top: 15px;">
                                        <telerik:radgrid id="RadGridActiveInquiry" runat="server" gridlines="None" allowpaging="true" allowsorting="true" autogeneratecolumns="false"
                                            allowmultirowselection="True" width="100%" PageSize="10"
                                            onneeddatasource="RadGridActiveInquiry_NeedDataSource" onitemcreated="RadGridActiveInquiry_ItemCreated" onitemdatabound="RadGridActiveInquiry_ItemDataBound" onitemcommand="RadGridActiveInquiry_ItemCommand">
                                            <GroupingSettings CaseSensitive="false" />
                                            <ExportSettings ExportOnlyData="false" HideStructureColumns="true" IgnorePaging="true" Excel-Format="Biff" />
                                            <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                   <MasterTableView DataKeyNames="CustomerId" CommandItemDisplay="Top" ShowHeadersWhenNoRecords="true" EnableNoRecordsTemplate="true" ClientDataKeyNames="CustomerId">
                                   <%--<NoRecordsTemplate>
                                   <div><%= Resources.UI.ActiveInquiry_HTML_NoRecordsWereReturned %></div>
                                   </NoRecordsTemplate>--%>
                                                <%--<CommandItemSettings ExportToCsvText="<%$ Resources:UI, ActiveInquiry_Text_ExportToCSV %>" ExportToExcelText="<%$ Resources:UI, ActiveInquiry_Text_ExportToExcel %>" ShowRefreshButton="false"
                                       ShowExportToExcelButton="true" ShowExportToCsvButton="true" ShowAddNewRecordButton="false" />--%>
                                                <CommandItemSettings  ShowRefreshButton="false" ShowExportToExcelButton="true" ShowExportToCsvButton="true" ShowAddNewRecordButton="false" />
                                   <RowIndicatorColumn HeaderStyle-Width="20px" />
                                   <ExpandCollapseColumn HeaderStyle-Width="20px" />
                                   <Columns>
                                                    <telerik:GridBoundColumn DataField="CustomerId" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_CustomerId %>" UniqueName="id" ItemStyle-VerticalAlign="Top" Display="false" Exportable="false" >
                                                        <ItemStyle VerticalAlign="Top"></ItemStyle>                                                        
                                                    </telerik:GridBoundColumn>
                                   <telerik:GridClientSelectColumn UniqueName="select" ItemStyle-VerticalAlign="Top" ItemStyle-Width="15px" HeaderStyle-Width="15px" Exportable="false" />
                                                    <telerik:GridTemplateColumn UniqueName="image" AllowFiltering="false" ItemStyle-VerticalAlign="Top" HeaderStyle-Width="43px" Exportable="false">
                                                        <ItemTemplate>
                                                            <asp:Image ID="menuIcon" runat="server" ImageUrl="<%$ Resources:UI, ActiveInquiry_ImageUrl_menuIcon %>" />
                                                            <telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="menuIcon" HideEvent="LeaveTargetAndToolTip"
                                                                Position="MiddleRight" Width="200px" SkinID="RadToolTipDefault" AutoCloseDelay="10000"
                                                                HideDelay="0">
                                                                <div style="margin: 15px;">
                                                                    <div style="background-color: #1FA9FF; width: 100%; text-transform: uppercase; color: White;">
                                                                        <div style="padding: 5px;">
                                                                            <asp:placeholder ID="Placeholder2" runat="server"><%= Resources.UI.ActiveInquiry_HTML_SoloActions %></asp:placeholder></div>
                                                                    </div>
                                                                    <div style="margin-left: 2px;">
                                                                        <p style="line-height: 20px;">
                                                                            <asp:LinkButton ID="LinkButtonTransfer" runat="server" CausesValidation="false" CommandName="Transfer"
                                                                            Text="<%$ Resources:UI, ActiveInquiry_Text_TransferInquiry %>" />
                                                                        </p>
                                                                        </div>
                                                                    <div style="margin-left: 2px;">
                                                                        <p style="line-height: 20px;">
                                                                            <asp:LinkButton ID="LinkButtonCopy" runat="server" CausesValidation="false" CommandName="Copy"
                                                                            Text="<%$ Resources:UI, ActiveInquiry_Text_CopyInquiry %>" />
                                                                        </p>
                                                                    </div>
                                                                    <div style="margin-left: 2px;">
                                                                        <p style="line-height: 20px;">
                                                                            <asp:LinkButton ID="LinkButtonStatus" runat="server" CommandName="Status"
                                                                                CausesValidation="false"><%= Resources.UI.ActiveInquiry_HTML_UpdateStatus_1 %></asp:LinkButton>
                                                                        </p>
                                                                    </div>
                                                                </div>
                                                            </telerik:RadToolTip>
                                                        </ItemTemplate>
                                                    </telerik:GridTemplateColumn>
                                   <telerik:GridBoundColumn DataField="DaysOpen" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_DaysOpen %>" UniqueName="DaysOpen" ItemStyle-Width="65px" ItemStyle-HorizontalAlign="Left">
                                                        <HeaderStyle Width="79px"></HeaderStyle>
                                                    </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="AssignedTo" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_AssignedTo %>" UniqueName="AssignedTo" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Left">
                                                        <HeaderStyle Width="105px"></HeaderStyle>
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridTemplateColumn HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_ClientName %>" UniqueName="ClientName" ItemStyle-Width="70px"
   SortExpression="ClientName" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Left">
   <ItemTemplate>
   <asp:LinkButton runat="server" ID="LinkButtonDetails" OnClick="LinkButtonDetails_Click" CausesValidation="False" />
   </ItemTemplate>
                                                        <HeaderStyle Width="85px"></HeaderStyle>
   </telerik:GridTemplateColumn>
                                   <telerik:GridBoundColumn DataField="CallerName" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_CallerName %>" UniqueName="CallerName" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Left">
                                                        <HeaderStyle Width="87px"></HeaderStyle>
                                                    </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="InquiryCaseType" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_InquiryCaseType %>" UniqueName="CaseType" ItemStyle-Width="120px" ItemStyle-HorizontalAlign="Left">
                                                        <HeaderStyle Width="131px"></HeaderStyle>
                                                    </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="SalesPerson" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_SalesPerson %>" UniqueName="SalesPerson" ItemStyle-Width="70px" ItemStyle-HorizontalAlign="Left">
                                                        <HeaderStyle Width="88px"></HeaderStyle>
                                                    </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="ReferralSource" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_ReferralSource %>" UniqueName="ReferralSource" ItemStyle-Width="80px" ItemStyle-HorizontalAlign="Left">
                                                        <HeaderStyle Width="97px"></HeaderStyle>
                                                    </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="InquiryFollowUpDate" DataFormatString="{0:MM/dd/yyyy}" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_FollowUpDate %>" UniqueName="FollowUpDate" ItemStyle-Width="60px">
                                                        <HeaderStyle Width="75px"></HeaderStyle>
                                                    </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="CreatedBy" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_CreatedBy %>" UniqueName="CreatedBy" ItemStyle-Width="60px" ItemStyle-HorizontalAlign="Left">
                                                        <HeaderStyle Width="90px"></HeaderStyle>
                                                    </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="Zip" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_Zip %>" UniqueName="Zip" ItemStyle-Width="26px" ItemStyle-HorizontalAlign="Left">
                                                        <HeaderStyle Width="45px"></HeaderStyle>
                                                    </telerik:GridBoundColumn>
                                   <telerik:GridBoundColumn DataField="Status" HeaderText="<%$ Resources:UI, ActiveInquiry_HeaderText_Status %>" UniqueName="Status" ItemStyle-Width="120px" ItemStyle-HorizontalAlign="Left">
                                                        <HeaderStyle Width="132px"></HeaderStyle>
                                                    </telerik:GridBoundColumn>
                                   </Columns>
                                   </MasterTableView>
                                   <ClientSettings Scrolling-UseStaticHeaders="True" AllowDragToGroup="true" ClientEvents-OnRowSelected="ActiveInquiry.showHideGroupAction"
                                   ClientEvents-OnRowDeselected="ActiveInquiry.showHideGroupAction" ClientEvents-OnGridCreated="ActiveInquiry.showHideGroupAction">
                                   <Selecting AllowRowSelect="true" UseClientSelectColumnOnly="true" />
                                   <Scrolling UseStaticHeaders="True" />
                                   <ClientEvents OnGridCreated="ActiveInquiry.showHideGroupAction" OnRowSelected="ActiveInquiry.showHideGroupAction"
                                   OnRowDeselected="ActiveInquiry.showHideGroupAction" />
                                   </ClientSettings>
                                   <FilterMenu EnableImageSprites="False" />
                                   <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default" />
                                   </telerik:radgrid>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </table>        
    </div>
</asp:Content>

Code behind code is below.


using ABS2.BUSINESS;
using ABS2.COMMON;
using ABS2.ENTITY;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
//using System.Web;
//using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

namespace ABS2.Customer
{
public partial class ActiveInquiry : ABS2.Framework.BasePage
{

        private List<cuCaseType> _cuCaseTypes;
        private List<cuStatusType> _cuStatusTypes;

        #region Init
        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            this.PreRender += new System.EventHandler(this.ActiveInquiriesSearch_PreRender);
        }

        private void ActiveInquiriesSearch_PreRender(object sender, EventArgs e)
        {
            //if (!Page.IsPostBack)
            //{
            //    BindDropDowns();
            //    SetInitialSearchCriteria();
            //}
        }

        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument == "RebindGrid")
            {
                RadGridActiveInquiry.MasterTableView.SortExpressions.Clear();
                RadGridActiveInquiry.MasterTableView.GroupByExpressions.Clear();
                RadGridActiveInquiry.Rebind();
            }
        }
        #endregion

        public void BindDropDowns()
        {
            List<int> locationIDs = SessionBO.UserLocations.Select(x => x.Key).ToList();

            List<string> officeStaffRoles = new List<string> {UtilityHelpers.GetResource("officeRoleBranchManager"),
   UtilityHelpers.GetResource("officeRoleAdministrativeAssistant"),
   UtilityHelpers.GetResource("officeRoleFranchiseOwner"),
   UtilityHelpers.GetResource("officeRoleNurseManager"),
   UtilityHelpers.GetResource("officeRoleOfficeStaff"),
   UtilityHelpers.GetResource("officeRoleStaffingCoordinator"),
                UtilityHelpers.GetResource("officeRoleSalesRep")
   };

            UtilityHelpers.PopulateDropDown(RadComboBoxInquiryAssignedTo, new EmployeeBO().GetEmployeesInOfficeRoles(locationIDs, officeStaffRoles), Constants.DROP_DOWN_SELECT_ONE, true);
            RadComboBoxInquiryAssignedTo.DropDownWidth = UtilityHelpers.RadComboBoxDropDownWidth(RadComboBoxInquiryAssignedTo);
        }

        private void SetInitialSearchCriteria()
        {
            RadComboBoxInquiryAssignedTo.SelectedValue = "-1";
            RadGridActiveInquiry.DataSource = new object[] { };
            RadGridActiveInquiry.VirtualItemCount = 0;
           // RadGridActiveInquiry.Rebind();
        }

protected void Page_Load(object sender, EventArgs e)
{
RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
            manager.ClientEvents.OnRequestStart = "ActiveInquiry.onRequestStart";
manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager1_AjaxRequest);
            manager.AjaxSettings.AddAjaxSetting(manager, this.RadGridActiveInquiry);
            if (!IsPostBack)
            {
                Page.Form.DefaultButton = this.RadButtonSearch.UniqueID;
            }
            RadDatePickerFrom.Culture = Thread.CurrentThread.CurrentCulture;
            RadDatePickerFrom.DateInput.DateFormat = "d";
            RadDatePickerFrom.DateInput.DisplayDateFormat = "d";
            RadDatePickerFrom.Calendar.CultureInfo = Thread.CurrentThread.CurrentCulture;
            RadDatePickerFrom.Calendar.DayCellToolTipFormat = Thread.CurrentThread.CurrentCulture.DateTimeFormat.LongDatePattern;
            RadDatePickerTo.Culture = Thread.CurrentThread.CurrentCulture;
            RadDatePickerTo.DateInput.DateFormat = "d";
            RadDatePickerTo.DateInput.DisplayDateFormat = "d";
            RadDatePickerTo.Calendar.CultureInfo = Thread.CurrentThread.CurrentCulture;
            RadDatePickerTo.Calendar.DayCellToolTipFormat = Thread.CurrentThread.CurrentCulture.DateTimeFormat.LongDatePattern;

            if (!Page.IsPostBack)
            {
                BindDropDowns();
                SetInitialSearchCriteria();
            }
        }

        protected void ImageSearchIcon_Click(object sender, EventArgs e)
        {
            RadGridActiveInquiry.Rebind();
        }

        protected void ClearForm_Click(object sender, EventArgs e)
        {
            RadComboBoxInquiryAssignedTo.SelectedValue = "-1";
            RadDatePickerFrom.SelectedDate = null;
            RadDatePickerTo.SelectedDate = null;
            RadGridActiveInquiry.DataSource = new object[] { };
            RadGridActiveInquiry.MasterTableView.SortExpressions.Clear();
            RadGridActiveInquiry.MasterTableView.GroupByExpressions.Clear();
            RadGridActiveInquiry.VirtualItemCount = 0;
            //RadGridActiveInquiry.Rebind();
        }

protected void RadGridActiveInquiry_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
            DateTime dateFrom = RadDatePickerFrom.SelectedDate == null ? DateTime.Now.AddDays(-1000) : Convert.ToDateTime(RadDatePickerFrom.SelectedDate);
            DateTime dateTo = RadDatePickerTo.SelectedDate == null ? DateTime.Now.AddDays(30) : Convert.ToDateTime(RadDatePickerTo.SelectedDate);

            _cuCaseTypes = ABS2.Framework.ReferenceDataWebWrapper.GetType<cuCaseType>(SessionBO.TypeAncestors, SessionBO.LCID.Value, RefDataReturnType.ListT);
            _cuStatusTypes = ABS2.Framework.ReferenceDataWebWrapper.GetType<cuStatusType>(SessionBO.TypeAncestors, SessionBO.LCID.Value, RefDataReturnType.ListT);

            if (RadComboBoxInquiryAssignedTo.SelectedIndex > 0)
            {
                RadGridActiveInquiry.DataSource = new CustomerBO().GetActiveInquiries(SessionBO.UserLocations.Keys.ToList(), dateFrom, dateTo, Convert.ToInt32(RadComboBoxInquiryAssignedTo.SelectedValue));
            }
            else
            {
                RadGridActiveInquiry.DataSource = new CustomerBO().GetActiveInquiries(SessionBO.UserLocations.Keys.ToList(), dateFrom, dateTo);
            }

}

        protected void RadGridActiveInquiry_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "ExportToExcel")
            {                
                RadGridActiveInquiry.ExportSettings.ExportOnlyData = true;
                RadGridActiveInquiry.MasterTableView.ExportToExcel();
            }
            else if (e.CommandName == "ExportToCsv")
            {             
                RadGridActiveInquiry.ExportSettings.ExportOnlyData = true;
                RadGridActiveInquiry.MasterTableView.ExportToCSV();
            }
        }

        protected void RadGridActiveInquiry_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                var item = (GridDataItem)e.Item;
                var dataItem = item.DataItem as SalesInquiry;
                if (dataItem != null)
                {
                    // Solo Menu Items
                    var linkButtonStatus = e.Item.FindControl("LinkButtonStatus") as LinkButton;
                    var linkButtonTransfer = e.Item.FindControl("LinkButtonTransfer") as LinkButton;
                    var linkButtonCopy = e.Item.FindControl("LinkButtonCopy") as LinkButton;

                    try
                    {
                        var radToolTip1 = e.Item.FindControl("RadToolTip1") as RadToolTip;

                        if (radToolTip1 != null)
                        {
                            if (linkButtonStatus != null)
                            {
                                linkButtonStatus.OnClientClick =
                                    String.Format(
                                        "CloseRadToolTip('" + radToolTip1.ClientID +
                                        "'); return ShowSoloForm('{0}','{1}');",
                                        dataItem.CustomerId, "Status");
                            }

                            if (linkButtonTransfer != null)
                            {
                                linkButtonTransfer.OnClientClick =
                                    String.Format(
                                        "CloseRadToolTip('" + radToolTip1.ClientID +
                                        "'); return ShowSoloForm('{0}','{1}');",
                                        dataItem.CustomerId, "Transfer");
                            }

                            if (linkButtonCopy != null)
                            {
                                linkButtonCopy.OnClientClick =
                                    String.Format(
                                        "CloseRadToolTip('" + radToolTip1.ClientID +
                                        "'); return ShowSoloForm('{0}','{1}');",
                                        dataItem.CustomerId, "Copy");
                            }
                        }
                    }
                    catch (Exception err)
                    {
                        ABS2.Framework.LogExceptions.LogException(err, this.Request, SessionBO.User.usUserId,
                                                              SessionBO.User.userName);
                    }
                }
                    }
                }

        protected void RadGridActiveInquiry_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                SalesInquiry dataItem = item.DataItem as SalesInquiry;
                if (dataItem != null)
                {
                    LinkButton linkButtonCustomer = (LinkButton)item["ClientName"].FindControl("LinkButtonDetails");
                    if (linkButtonCustomer != null)
                    {
                        linkButtonCustomer.Text = dataItem.ClientName.Length < 3 ? Resources.ApplicationConstants.ActiveInquiry_ClientName : dataItem.ClientName;
                        linkButtonCustomer.Attributes.Add("id", dataItem.CustomerId.ToString());
                    }
                    Func<cuCaseType, bool> filterCaseT = c => c.cuCaseTypeId.Equals(dataItem.InquiryCaseTypeId);
                    
                    var caseType = _cuCaseTypes.FirstOrDefault(filterCaseT);
                    if (caseType != null)
                    {
                        if (!String.IsNullOrWhiteSpace(_cuCaseTypes[0].typeName))
                            item["CaseType"].Text = caseType.typeName == null ? string.Empty : caseType.typeName;
                    }
                    Func<cuStatusType, bool> filterST = c => c.cuStatusTypeId.Equals(dataItem.StatusTypeId);


                    var statusType = _cuStatusTypes.FirstOrDefault(filterST);
                    if (statusType != null)
                    {
                        if (!String.IsNullOrWhiteSpace(_cuStatusTypes[0].typeName))
                            item["Status"].Text = statusType.typeName == null ? string.Empty : statusType.typeName;
                    }
                }
            }
        }

        protected void LinkButtonDetails_Click(object sender, EventArgs e)
        {
            List<string> selectedItems = new List<string>();
            foreach (GridDataItem gdi in RadGridActiveInquiry.SelectedItems)
            {
                selectedItems.Add(gdi.GetDataKeyValue("CustomerId").ToString());
            }
            LinkButton linkButtonDetails = (LinkButton)sender;
            selectedItems.Add(linkButtonDetails.Attributes["id"]);
            Response.Redirect("CustomerDetail.aspx?ID=" + linkButtonDetails.Attributes["id"] + "&GCIDS=" + string.Join(",", selectedItems) + "&type=1");
        }
        }
}


The animated GIF is attached for your reference.

Please suggest your thoughts.

Regards,
Srriam








Princy
Top achievements
Rank 2
 answered on 11 Aug 2014
5 answers
1.0K+ views
Hello,

I have a RadDropDownList that I would like to enlarge because it should be displayed on a tablet. How can I set a height on the component? 

If I set the height to 50px in the css class, nothing changes. Is there a property to change?


Thx
Princy
Top achievements
Rank 2
 answered on 11 Aug 2014
3 answers
358 views
I am using Telerik 2014 version. I checked, radchart can export only jpg or png. but i want export the chart to Excel as well as PDF with some other data.
Please let me know how to do.... 


Thanks in advance.
Princy
Top achievements
Rank 2
 answered on 11 Aug 2014
1 answer
1.0K+ views
I am trying to convert a gridview to a radgrid.

One issue I am having is to get certain rows to highlight with the color yellow when it matches the value of a specific column.

The grid view code works fine. The radgrid does not.
Radgrid is using a skin (web blue) so I am thinking that may be the issue.

Any help is appreciated.

 protected void GridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            // determine the value of the ViewableByClient field
            bool ViewableByClient =
             Convert.ToBoolean(DataBinder.Eval(e.Row.DataItem,
             "ViewableByClient"));
            if (ViewableByClient)
                // color the background of the row yellow
                e.Row.BackColor = Color.Yellow;
        }
    }

protected void RadGrid3_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            // determine the value of the ViewableByClient field
            bool ViewableByClient =
             Convert.ToBoolean(DataBinder.Eval(e.Row.DataItem,
             "ViewableByClient"));
            if (ViewableByClient)
                // color the background of the row yellow
                e.Row.BackColor = Color.Yellow;
        }
    }
Princy
Top achievements
Rank 2
 answered on 11 Aug 2014
1 answer
248 views
Hi,

We are using  “RadAsyncUpload” to upload the files. We are restricted files selection types by specifying AllowedFileExtensions=".zip,.rar".
Its working as expected but  when we try to open the file selection dialog it list all the files in XP Operating system  (IE8) .

Controls Version details.
Telerik.Web.UI
FileVersion:2011.1.519.40
ProductVersion:2001.1.519.40

Code:
 <telerik:RadAsyncUpload ID="PatchFileUploadControl" runat="server" MaxFileInputsCount="1"
   OnClientFileSelected="FileSelected" OnClientFilesUploaded="FileUploaded" AllowedFileExtensions=".zip,.rar">
</telerik:RadAsyncUpload>

Please let  us know any changes to be done.




Princy
Top achievements
Rank 2
 answered on 11 Aug 2014
1 answer
975 views
Good Afternoon,
in my html  I have a RadComboBox:

<telerik:RadComboBox ID="ddlDurationofAssign" runat="server" Width="130px" Font-Size="Small" CssClass="txtinput1" AutoPostBack="true" TabIndex="5" OnSelectedIndexChanged="ddlDurationofAssign_SelectedIndexChanged" OnClientFocus="ClientFocus" OnClientBlur="ClientBlur" >
<Items>
<telerik:RadComboBoxItem Text="SELECT TERM" Value="E" Selected="true" />
<telerik:RadComboBoxItem Text="Fall" Value="F" />
<telerik:RadComboBoxItem Text="Spring" Value="S" />
<telerik:RadComboBoxItem Text="Full Term" Value="W" />
</Items>
</telerik:RadComboBox>

On Page Load I would like to  hide "Full Term" item based on certain criteria. How can I do that?

Thanks so much for your help.
Shinu
Top achievements
Rank 2
 answered on 11 Aug 2014
9 answers
408 views
Hi,

I am trying to add a RadComboBox to my ASP.NET page using the ODataDataSource.

When I do it the (IMHO) prefered way like this:
<telerik:RadODataDataSource runat="server" ID="ODataDataSourceIBQueue">
        <Transport Read-DataType="JSONP">
            <Read Url="http://localhost/NiceWebApp/InsadBlackBoxModelService.svc/" />
        </Transport>
        <Schema>
            <telerik:DataModel ModelID="IBQueue" Set="IBQueues">
                <telerik:DataModelField FieldName="Code" />
                <telerik:DataModelField FieldName="Description" />
                <telerik:DataModelField FieldName="Notes" />
                <telerik:DataModelField FieldName="QueueID" />
                <telerik:DataModelField FieldName="QueueType" />
            </telerik:DataModel>
        </Schema>
    </telerik:RadODataDataSource>
 
    <telerik:RadComboBox runat="server" ID="RadComboBox1" EnableLoadOnDemand="true"
        DataModelID="IBQueue"
        DataTextField="Code"
        DataValueField="QueueID"
        ODataDataSourceID="ODataDataSourceIBQueue">
    </telerik:RadComboBox>

I get the message 'DataSource with id ODataDataSourceIBQueue was not found on this page'

 When I add the OData settings inside the RadComboBox, like this:
<telerik:RadComboBox runat="server" ID="RadComboBox2" EnableLoadOnDemand="true">
        <WebServiceSettings Path="http://localhost/NiceWebApp/InsadBlackBoxModelService.svc">
            <ODataSettings ResponseType="JSONP">
                <Entities>
                    <telerik:ODataEntityType Name="IBQueue"
                                             DataValueField="QueueID"
                                             DataTextField="Code" />
                </Entities>
                <EntityContainer>
                    <telerik:ODataEntitySet EntityType="IBQueue"
                                            Name="IBQueues" />
                </EntityContainer>
            </ODataSettings>
        </WebServiceSettings>
    </telerik:RadComboBox>

It works as expected.

I have the same problem with the RadTreeView..

Can anyone advise on this? Or might it be a bug?

I am using VS2012, .NET 4.5, Telerik RadControls for ASP.NET AJAX 2012 Q2 Version 2012.2.815.40

Regards,

Insad

EDIT: Copy/Paste issue in samples corrected
احمد
Top achievements
Rank 1
 answered on 09 Aug 2014
2 answers
155 views
Hi all
I have noticed following behavior in our SharePoint pages.
When RAD editor web part is added to a zone, I am able to edit the content within the control.
After I save the page, check in and then edit the page, I am unable to edit the content. I must add that this happens only in Internet Explorer. Upon looking into the mark up of the page, I noticed that the nearest <div > is set with unselectable=on

ex:

<div id="ctl00_m_g_de8edd76_8f8a_4459_a956_04989983b73e_ctl00_contentDivclass="reContentArea reContentAreaTogglecontenteditable="truestyle="position: relative; height: 211px;unselectable="on"></div>

Since the div is unselectable, I am not able to get focus in the content editing area.

 
Does anyone know why IE injects unselectable="on" into the content area.
Thanks in advance

Victor
Top achievements
Rank 1
 answered on 09 Aug 2014
0 answers
55 views
I have done this in the initial work file and everything went fine. After i integrate this into the project, this error ->  "System.NullReferenceException: Object reference not set to an instance of an object." appear.

Stack Trace: 

[NullReferenceException: Object reference not set to an instance of an object.]
UltimateFurniture.CustomerReg.btnConfirm_Click1(Object sender, EventArgs e) in C:\Users\Ang yong xin\Documents\ecommerce application project\UltimateFurniture backup(6)\UltimateFurniture\UltimateFurniture\Register.aspx.cs:85
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9752554
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
Lock
Top achievements
Rank 1
 asked on 08 Aug 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?