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

[Solved] Use Static Headers decrease performance

5 Answers 173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff Tang
Top achievements
Rank 1
Jeff Tang asked on 03 Jun 2009, 03:10 AM
I have the following client settings in my RadGrid using the static header. However, when I try to select a row, the reaction is very slow and the layout out the grid content even totally change.(eg. the column width become very wide) I need to allso rows selection and use static hearder with scrolling. Could you please advice what is the problem of my grid. Thanks.
                                    

           <telerik:RadGrid ID="rgAfftAdd" runat="server" AutoGenerateColumns="False"
                                               GridLines="None" Skin="WebBlue" Width="100%" BorderStyle="Solid"
                                               BorderColor="#3399FF" BorderWidth="1px"
                                               AllowMultiRowSelection="True" AllowSorting="True"
                                               onprerender="rgAfftAdd_PreRender">
                                                 
                                        <SelectedItemStyle BackColor="#99CCFF" />      
                                     
                                        <ClientSettings>
                                                 <Selecting AllowRowSelect="true" />
                                               <Scrolling AllowScroll="True" UseStaticHeaders="true"></Scrolling> 
                                        </ClientSettings>   

                                        <MasterTableView Font-Bold="False" Font-Italic="False" Font-Overline="False"
                                                         Font-Strikeout="False" Font-Underline="False" PageSize="2000"
                                                        
                                            ClientDataKeyNames="TYPE, START_TIME, ADDR, SP_CUST, REC_NO, lid, ln_sub_no"
                                            Width="98%" AllowMultiColumnSorting="True">
                                                          
                                                <RowIndicatorColumn>
                                                    <HeaderStyle Width="20px"></HeaderStyle>
                                                </RowIndicatorColumn>

                                                <ExpandCollapseColumn>
                                                    <HeaderStyle Width="20px"></HeaderStyle>
                                                </ExpandCollapseColumn>
                                           
                                                <Columns>
                                                    <telerik:GridBoundColumn DataField="TYPE" HeaderText="Type" UniqueName="TYPE">
                                                        <HeaderStyle Width="12%" />
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="START_TIME" DataType="System.DateTime"
                                                                             HeaderText="Start Time" UniqueName="START_TIME"
                                                                             DataFormatString="{0:dd/MM/yyyy HH:mm:ss}">
                                                        <HeaderStyle Width="14%" />
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="ADDR" HeaderText="Address" UniqueName="ADDR">
                                                        <HeaderStyle Width="59%" />
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="SP_CUST" HeaderText="Sp. Cust."
                                                                             UniqueName="SP_CUST" Aggregate="Count" ReadOnly="True">
                                                        <HeaderStyle Width="15px" />
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="REC_NO" HeaderText="Rec_No" UniqueName="REC_NO" Visible = "false">
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="lid" UniqueName="lid" Visible = "false" >
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="ln_sub_no" UniqueName="ln_sub_no" Visible = "false">
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                </Columns>
                                               
                                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                                <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False"
                                                             Font-Strikeout="False" Font-Underline="False" ForeColor="Black" Wrap="True" />       
                                        </MasterTableView>                   

                                        <FilterMenu EnableTheming="True" Skin="WebBlue">
                                            <CollapseAnimation Duration="200" Type="OutQuint" />
                                        </FilterMenu>

                                </telerik:RadGrid>



5 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 04 Jun 2009, 01:52 PM
Hi Jeff,

I tried to reproduce the problem but to no success as evidenced by the sample attached to this post. I have tried to follow closely your mark-up. Could you try to modify it so that the misalignment is reproduced and get back to us.

Thank you.

Greetings,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jeff Tang
Top achievements
Rank 1
answered on 05 Jun 2009, 01:35 AM
I am using Microsoft Visual Studio 2008, .NET Framework 3.5 and Telerik RadControls for ASPNET AJAX Q2 2008 to produce my website. Please find below the complete code for my page. Even I don't use the client operation

OnRowDblClick="Row_Select" OnRowClick="Row_Single_Click" 

the speed still very slow when using static header. I am using ORACLE as my database so I used this "rgAdvSearch.DataSource = (DataTable)Session["AdvSearchResult"];" to assign the DataSource to the grid in code behind.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="LOSISAffectedAddressList.aspx.cs" Inherits="_Default" Title="Untitled Page" %>

<%@ Register assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <script language="javascript" type="text/javascript">
     
        function ModalDlgShow(Url, EventHandler, args) {
           
            var s1 = args;
           
            modalDlg = window.open(Url, "new", args);
            modalDlg.focus();
        }
       
        function ToHideOnly() {
                   
            $find("MasterPageID_ContentPlaceHolder1_ModalPopupExtender1").hide();      
                 
        }
       
        function ToViewAndHide(parentWindow) {
                   
            $find("MasterPageID_ContentPlaceHolder1_ModalPopupExtender1").hide();
         
            var Args = new Array(parentWindow);
         window.showModalDialog('LOSISAdvChkListSimple.aspx?lid=' + document.getElementById ("MasterPageID_ContentPlaceHolder1_hfLid").value + "&ln_sub_no=" + document.getElementById ("MasterPageID_ContentPlaceHolder1_hfLnSubNo").value , Args, 'dialogHeight:680px;dialogWidth:950px;center=yes;resizable=0;scroll=yes;status=no;help=no');
         //  window.open('LOSISAdvChkListSimple.aspx?lid=' + document.getElementById ("MasterPageID_ContentPlaceHolder1_hfLid").value + "&ln_sub_no=" + document.getElementById ("MasterPageID_ContentPlaceHolder1_hfLnSubNo").value , '','toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=900,height=500,top=0,left=0');
  
        }

    </script>
   
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" height="100%" width="100%" HorizontalAlign="NotSet" LoadingPanelID="RadAjaxLoadingPanel1">

        <table width="100%">
            <tr valign="top">
                <td style="width: 130px">
                     <asp:Label ID="Label3" runat="server" ForeColor="Blue" Text = "Selection Criteria : "></asp:Label>
                </td>
                <td>        
                     <asp:Label ID="lblSelCriteria" runat="server" ForeColor="Blue"></asp:Label>
                </td>
            </tr>
         </table>
        
         <table width="100%">
            <tr>
                <td style="width: 100%" colspan="3">
                      <div id="Div1" runat="server">
                     
                            <script type="text/javascript">
                     
                                function Row_Select(sender, eventArgs) {
                                       
                                    if (eventArgs.getDataKeyValue("SP_CUST") == "")
                                       alert("No Special Customer Address is found for the address of this record.");
                                    else
                                    {              
                                      ModalDlgShow("LOSISSpDetl.aspx?lid=" + eventArgs.getDataKeyValue("lid") + "&ln_sub_no=" + eventArgs.getDataKeyValue("ln_sub_no"), "", "width=730, height=510, left=180, top=70, toolbar=0, status=0,menubar=0, scrollbars=0, resizable=0");
                                    }             
                                }
                               
                                function Row_Single_Click(sender, eventArgs) {
                                                  
                                   var radgrid = $find('<%=rgAfftAdd.ClientID%>');  
                                   var noOfSelected = radgrid.get_masterTableView().get_selectedItems().length;
                                   var button = document.getElementById ("MasterPageID_ContentPlaceHolder1_pbCreateCall"); 
                                   var button2 = document.getElementById ("pbSPCust"); 
                                                                         
                                   if (noOfSelected > 0)
                                   {
                                        button.disabled = false;
                                        button2.disabled = false;
                                   }
                                   else
                                   {
                                        button.disabled = true;      
                                        button2.disabled = true;
              
                                    }                       
                                                           
                                   if (eventArgs.getDataKeyValue("REC_NO") == "")
                                   {}  
                                   else
                                   {
                                     var v1 = document.getElementById ("MasterPageID_ContentPlaceHolder1_hfLid"); 
                                     var v2 = document.getElementById ("MasterPageID_ContentPlaceHolder1_hfLnSubNo");     
                                   
                                     v1.value = eventArgs.getDataKeyValue("lid");
                                     v2.value = eventArgs.getDataKeyValue("ln_sub_no");
                                   }
                                
                                   if (eventArgs.getDataKeyValue("SP_CUST") == "") 
                                   {
                                        var hfSpecCust = document.getElementById ("MasterPageID_ContentPlaceHolder1_hfSpecCust");     
                                        hfSpecCust.value = 'N';
                                     
                                   }
                                   else
                                   {
                                        var hfSpecCust = document.getElementById ("MasterPageID_ContentPlaceHolder1_hfSpecCust");     
                                        hfSpecCust.value = 'Y';                                     
                                   }  
                                 }  
                                
                                 function pbSPCust_onclick() {      
                                
                                     var radgrid = $find('<%=rgAfftAdd.ClientID%>');  
                                     var noOfSelected = radgrid.get_masterTableView().get_selectedItems().length;
                                       
                                     if (noOfSelected > 0)
                                     { 
                                          var hfSpecCust = document.getElementById ("MasterPageID_ContentPlaceHolder1_hfSpecCust");     
                                         
                                          if (hfSpecCust.value == 'Y')
                                          {
                                             var v1 = document.getElementById ("MasterPageID_ContentPlaceHolder1_hfLid"); 
                                             var v2 = document.getElementById ("MasterPageID_ContentPlaceHolder1_hfLnSubNo");     
                                         
                                             ModalDlgShow("LOSISSpDetl.aspx?lid=" + v1.value + "&ln_sub_no=" + v2.value, "", "width=730, height=600, left=180, top=70, toolbar=0, status=0,menubar=0, scrollbars=0, resizable=0");
                                                                  
                                          }
                                          else
                                          {
                                            alert("No Special Customer Address is found for the address of this record.");
                                          }
                                      }
                                 }    
                                
                                 function pbDeselectAll_onclick() {
               
                                    var radgrid = $find('<%=rgAfftAdd.ClientID%>');  
                                    radgrid.get_masterTableView().clearSelectedItems();
                                   
                                    var button = document.getElementById ("MasterPageID_ContentPlaceHolder1_pbCreateCall"); 
                                    button.disabled = true;
                                   
                                    var button2 = document.getElementById ("pbSPCust"); 
                                    button2.disabled = true;
                            
                                 }           

                            </script>       
                
                              <telerik:RadGrid ID="rgAfftAdd" runat="server" AutoGenerateColumns="False"
                                               GridLines="None" Skin="WebBlue" Width="100%" BorderStyle="Solid"
                                               BorderColor="#3399FF" BorderWidth="1px"
                                               AllowMultiRowSelection="True" AllowSorting="True">
                                                 
                                        <SelectedItemStyle BackColor="#99CCFF" />      
                                     
                                        <ClientSettings>
                                               <Selecting AllowRowSelect="True" />
                                               <ClientEvents OnRowDblClick="Row_Select" OnRowClick ="Row_Single_Click" />                               
                                               <Scrolling AllowScroll="True"></Scrolling> 
                                        </ClientSettings>   

                                        <MasterTableView Font-Bold="False" Font-Italic="False" Font-Overline="False"
                                                         Font-Strikeout="False" Font-Underline="False" PageSize="2000"
                                                        
                                            ClientDataKeyNames="TYPE, START_TIME, ADDR, SP_CUST, REC_NO, lid, ln_sub_no"
                                            Width="98%" AllowMultiColumnSorting="True">
                                                          
                                                <RowIndicatorColumn>
                                                    <HeaderStyle Width="20px"></HeaderStyle>
                                                </RowIndicatorColumn>

                                                <ExpandCollapseColumn>
                                                    <HeaderStyle Width="20px"></HeaderStyle>
                                                </ExpandCollapseColumn>
                                           
                                                <Columns>
                                                    <telerik:GridBoundColumn DataField="TYPE" HeaderText="Type" UniqueName="TYPE">
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="START_TIME" DataType="System.DateTime"
                                                                             HeaderText="Start Time" UniqueName="START_TIME"
                                                                             DataFormatString="{0:dd/MM/yyyy HH:mm:ss}">
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="ADDR" HeaderText="Address" UniqueName="ADDR">
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="SP_CUST" HeaderText="Sp. Cust."
                                                                             UniqueName="SP_CUST" Aggregate="Count" ReadOnly="True">
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="REC_NO" HeaderText="Rec_No" UniqueName="REC_NO" Visible = "false">
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="lid" UniqueName="lid" Visible = "false" >
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="ln_sub_no" UniqueName="ln_sub_no" Visible = "false">
                                                        <ItemStyle VerticalAlign="Top" />
                                                    </telerik:GridBoundColumn>
                                                </Columns>
                                               
                                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                                <HeaderStyle Font-Bold="True" Font-Italic="False" Font-Overline="False"
                                                             Font-Strikeout="False" Font-Underline="False" ForeColor="Black" Wrap="True" />       
                                        </MasterTableView>                   

                                        <FilterMenu EnableTheming="True" Skin="WebBlue">
                                            <CollapseAnimation Duration="200" Type="OutQuint" />
                                        </FilterMenu>

                                </telerik:RadGrid>
             
                    </div>               
                </td>
            </tr>
           
            <tr>
                <td style="width: 130px">
                            <asp:Label ID="Label2" runat="server" Text="Partial Address : "></asp:Label>
                </td>
                <td>           
                            <telerik:RadTextBox ID="dfFilter" runat="server" Skin="WebBlue" Width="350px">
                            </telerik:RadTextBox>
                             <asp:Button ID="pbFilter" runat="server" Text="Filter" onclick="pbFilter_Click" Height="21px" />
                </td>
                <td align = "right">
                    <asp:Label ID="lblNoOfRec" runat="server"></asp:Label>
                </td>
            </tr>        
        </table>
   </telerik:RadAjaxPanel>
     
   <table width = "100%">
            <tr>
                <td colspan = "5" style="width: 494px; height: 20px;">
                    <input id="pbSPCust" style="width: 84px" type="button" value="Special Cust" onclick="return pbSPCust_onclick()" disabled="disabled" />
                    <asp:Button ID="pbDownload" runat="server" OnClick="pbDownload_Click" Text="Download" />
                    <asp:Button ID="pbCreateCall" runat="server" Text="Create Call" Enabled="false" />
                    <asp:Button ID="pbList" runat="server" OnClick="pbList_Click" Text="Print List" />
                    <input id="pbDeselectAll" style="width: 84px" type="button" value="Deselect All" onclick="return pbDeselectAll_onclick()" />
                </td>
                <td align="right">
                    <asp:Button ID="pbBack" runat="server"  Text="Back" onclick="pbBack_Click"
                        Width="70px" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:HiddenField ID="hfLid" runat="server" />
                </td>
                <td style="width: 130px">
                    <asp:HiddenField ID="hfLnSubNo" runat="server" />
                </td>
                <td>
                    <asp:HiddenField ID="hfFlag" runat="server" Value="5" />
                </td>
                <td>
                    <asp:HiddenField ID="hfSpecCust" runat="server"/>
                </td>
                <td>
               
                </td>
            </tr>
    </table>
    
     
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server"
                     height="75px" width="75px" Transparency="50" BackColor="Black">
                     <img alt="Loading..."
                          src='Common/Img/ajax-loader.gif'
                          style="border:0px;" width="50" height="50" />
    </telerik:RadAjaxLoadingPanel>
     
    <asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px" Style="display: none" CssClass="modalPopup">
        <table class = "popup">
            <tr>
                <td colspan="2">
                    <asp:Label ID="Label1" runat="server" Text="Show Related Loss of Supply Information?" Width="282px"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align = "right">
                    <asp:Button ID="pbYes" runat="server" Text="Yes" Width="57px" OnClick="pbYes_Click" OnClientClick="ToViewAndHide(window.self)"  />
                </td>
                <td align="left">
                    <asp:Button ID="pbNo" runat="server" Text="No" Width="59px" OnClick="pbNo_Click" OnClientClick="ToHideOnly()"  />
                </td>
            </tr>
        </table>
     </asp:Panel>

     <cc1:ModalPopupExtender
            ID="ModalPopupExtender1" runat="server"
            TargetControlID="pbCreateCall"
            PopupControlID="Panel1"
            BackgroundCssClass="modalBackground"   
            DropShadow="true">
     </cc1:ModalPopupExtender> 
         
</asp:Content>

 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using Lib.Report;
using Lib.General;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using Telerik.Web.UI;
using Connectivity;

public partial class _Default : System.Web.UI.Page
{
 public const string TYPE_HV = "HV Tripping";
 public const string TYPE_SD = "Shutdown";
 public const string TYPE_Case = "SV Case";
 public const string TYPE_Call = "SV Call";
 public const string TYPE_VD = "Voltage Dip";
 public const string TYPE_VDAll = "Supply Disturbance (All)";
 public string sAction = "";

 private const string SQL_ModuleID = "LOSISAdvChkList";

 protected void Page_Load(object sender, EventArgs e)
 {
  try
  {
   int iID = ((String)Session["loginId"]).Length;
   Label lblID = (Label)this.Master.FindControl("lblLoginId");
   lblID.Text = (String)Session["loginId"];
  }
  catch
  {
   Session.Add("loginId", User.Identity.Name.Substring(User.Identity.Name.IndexOf("\\") + 1).ToUpper());
   Label lblID = (Label)this.Master.FindControl("lblLoginId");
   lblID.Text = (String)Session["loginId"];

   //Response.Redirect("LOSISDeny.aspx");
  }

  this.Title = "Loss of Supply Information System - Advance Check";

  if (!FnLOSIS.GetEnv().Equals("PRD"))
   this.Title = "[" + FnLOSIS.GetEnv() + "] " + this.Title;

  RadMenu rm = (RadMenu)this.Master.FindControl("RadMenu1");
  rm.Items[0].CssClass = "selectedLink";

  lblSelCriteria.Text = ((String)Session["SelCriteria"]);

  rgAdvSearch.DataSource = (DataTable)Session["AdvSearchResult"];

  try
  {
   int iScreenheight = int.Parse(((String)Session["ScreenHeight"]));
   rgAdvSearch.ClientSettings.Scrolling.ScrollHeight = Unit.Pixel((int)Math.Round((iScreenheight * 0.65), 0));
  }
  catch
  {
   rgAdvSearch.ClientSettings.Scrolling.ScrollHeight = Unit.Pixel(500);
  }

  try
  {
   if (((DataTable)Session["AdvSearchResult"]).Rows.Count > int.Parse((string)Session["MaxRec"]))
   {
    rgAdvSearch.MasterTableView.AllowPaging = true;
    rgAdvSearch.MasterTableView.PageSize = int.Parse((string)Session["MaxRec"]);
   }
  }
  catch
  { }

  sAction = FnLOSIS.GetParam(Request, "action");
  if (sAction != null && sAction.Equals("Checking"))
  {
   ((RadMenu)this.Master.FindControl("RadMenu1")).Visible = false;
   pbBack.Visible = false;
  }

  UpdateRecNo();
 }

 private void UpdateRecNo()
 {
  lblNoOfRec.Text = "No. of Records : " + ((DataTable)rgAdvSearch.DataSource).DefaultView.Count.ToString();
 }

 private void DownloadFile(string fpath, string fname, bool forceDownload)
 {
  string path = fpath;
  string name = fname;
  string ext = "." + fname.Split('.')[1];
  string type = "";

  // set known types based on file extension 
  if (ext != null)
  {
   switch (ext.ToLower())
   {
    case ".txt":
     type = "text/plain";
     break;
    case ".dat":
     type = "text/plain";
     break;
    case ".pdf":
     type = "application/pdf";
     break;
   }
  }
  if (forceDownload)
  {
   Response.AppendHeader("content-disposition", "attachment; filename=" + name);
  }
  if (type != "")
   Response.ContentType = type;
  Response.WriteFile(path + name);
  Response.End();

  File.Delete(path + name);
 }

 protected void pbDownload_Click(object sender, EventArgs e)
 {
  String sTempFilePath = @"C:\Temp\Losis\";
  String sTempFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + "_AdvChk.txt";

  StreamWriter sw = new StreamWriter(sTempFilePath + sTempFileName);
  
  string sHeaderText = "";

  for (int i = 0; i < rgAdvSearch.Columns.Count-2; i++)
  {
   if (i != 0)
    sHeaderText += "|" + rgAdvSearch.Columns[i].HeaderText;
   else
    sHeaderText += rgAdvSearch.Columns[i].HeaderText;
  }

  sw.WriteLine(sHeaderText);

  string sContent = "";
  DataTable dtSource = (DataTable)rgAdvSearch.DataSource;
  string sDateFrom = "";
  string sDateTo = "";

  if (rgAdvSearch.SelectedIndexes.Count == 0)
  {
   for (int j = 0; j < dtSource.Rows.Count; j++)
   {
    try
    {
     sDateFrom = DateTime.Parse(dtSource.Rows[j][2].ToString()).ToString("dd/MM/yyyy HH:mm:ss");
    }
    catch
    {
     sDateFrom = "";
    }

    try
    {
     sDateTo = DateTime.Parse(dtSource.Rows[j][3].ToString()).ToString("dd/MM/yyyy HH:mm:ss");
    }
    catch
    {
     sDateTo = "";
    }
     
    sContent += (dtSource.Rows[j][7].ToString().Equals("true") ? "Y" : "N") + '|' + dtSource.Rows[j][0].ToString() + '|' +
       sDateFrom + '|' + sDateTo + '|' +
       dtSource.Rows[j][4].ToString() + '|' + dtSource.Rows[j][5].ToString() + '|' + dtSource.Rows[j][1].ToString();

    sw.WriteLine(sContent);
    sContent = "";
   }
  }
  else
  {
   for (int j = 0; j < rgAdvSearch.SelectedIndexes.Count; j++)
   {
    sContent += rgAdvSearch.SelectedItems[j].Cells[10].Text.Equals("true")?"Y":"N"  + '|' + rgAdvSearch.SelectedItems[j].Cells[3].Text + '|' +
       rgAdvSearch.SelectedItems[j].Cells[4].Text + '|' + (rgAdvSearch.SelectedItems[j].Cells[5].Text.Equals("&nbsp;") ? "": rgAdvSearch.SelectedItems[j].Cells[5].Text) + '|' +
       rgAdvSearch.SelectedItems[j].Cells[6].Text + '|' + rgAdvSearch.SelectedItems[j].Cells[7].Text + '|' +
       rgAdvSearch.SelectedItems[j].Cells[8].Text;
    sw.WriteLine(sContent);
    sContent = "";
   }
  }

  sw.Close();

  DownloadFile(sTempFilePath, sTempFileName, true);

 }
 protected void pbList_Click(object sender, EventArgs e)
 {
  string sSelCrit = ((String)Session["SelCriteria"]);
  string c_sPath11 = Context.Request.ServerVariables.Get("APPL_PHYSICAL_PATH") + "Report11\\";

  ReportDocument rptMain = FnCrystalReport11.OpenReport(c_sPath11 + "SVR45522.rpt");
  FnCrystalReport11.SetParamValue(rptMain, "SelCrit", sSelCrit);

  if (rgAdvSearch.SelectedIndexes.Count == 0)
  {
   DataTable dtData;
   dtData = (DataTable)rgAdvSearch.DataSource;
   FnCrystalReport11.SetDataSource(rptMain, 0, dtData);
  }
  else
  {
   DataTable dtData = new DataTable();
   dtData.Columns.Add("TYPE");
   dtData.Columns.Add("REF_NO");
   dtData.Columns.Add("START_TIME");
   dtData.Columns.Add("end_TIME");
   dtData.Columns.Add("NATURE_CCT");
   dtData.Columns.Add("STATUS_SS");

   DataRow row;

   for (int i = 0; i < rgAdvSearch.SelectedIndexes.Count; i++)
   {
    row = dtData.NewRow();

    row["TYPE"] = rgAdvSearch.SelectedItems[i].Cells[3].Text.Equals("&nbsp;") ? "": rgAdvSearch.SelectedItems[i].Cells[3].Text;
    row["REF_NO"] = rgAdvSearch.SelectedItems[i].Cells[8].Text.Equals("&nbsp;") ? "": rgAdvSearch.SelectedItems[i].Cells[8].Text ;
    row["START_TIME"] = rgAdvSearch.SelectedItems[i].Cells[4].Text.Equals("&nbsp;") ? "": rgAdvSearch.SelectedItems[i].Cells[4].Text;
    row["END_TIME"] = rgAdvSearch.SelectedItems[i].Cells[5].Text.Equals("&nbsp;") ? "":rgAdvSearch.SelectedItems[i].Cells[5].Text ;
    row["NATURE_CCT"] = rgAdvSearch.SelectedItems[i].Cells[6].Text.Equals("&nbsp;") ? "": rgAdvSearch.SelectedItems[i].Cells[6].Text;
    row["STATUS_SS"] = rgAdvSearch.SelectedItems[i].Cells[7].Text.Equals("&nbsp;") ? "" : rgAdvSearch.SelectedItems[i].Cells[7].Text;

    dtData.Rows.Add(row);
   }

   FnCrystalReport11.SetDataSource(rptMain, 0, dtData);
  }

  FnCrystalReport11.ExportReport(rptMain, ExportFormatType.PortableDocFormat, "C:\\temp\\Losis\\SVR45522.pdf");

  DownloadFile("C:\\Temp\\Losis\\", "SVR45522.pdf", true);
  

 }

 protected void hb_Click(object sender, EventArgs e)
 {
  FnDBConnection dbConn = FnLOSIS.GetDBConn(Context, "LOSIS");

  string sKey = hfKey.Value.ToString();
  string sExeName = "";
  string sExePath = "";

  Label lblID = (Label)this.Master.FindControl("lblLoginId");
  string sUserID  = lblID.Text;
  //string sUserID = (String)Session["loginId"];

  string sSql = "";
  
  sSql = @"SELECT value FROM lost_sys_param Where section = 'SV Param' and entry = 'SVMainExe' ";

  FnSql fnSql = dbConn.CreateSql(sSql, SQL_ModuleID, 1);

  if (!fnSql.ExecScalar(out sExeName))
   return;

  sSql = @"SELECT value FROM lost_sys_param Where section = 'SV Param' and entry = 'SVMainExePath' ";

  fnSql = dbConn.CreateSql(sSql, SQL_ModuleID, 2);

  if (!fnSql.ExecScalar(out sExePath))
   return;

  string sCommand = "";

  sCommand = "SV-LOSIS" + "|" + sUserID + "|" + "NIL" + "|" + sKey + "|" + sExePath + "|" + sExeName + "|" + FnLOSIS.GetEnv();

  if (FnLOSIS.GetEnv().Equals("PRD"))
  {
   StreamWriter sw = new StreamWriter(@"C:\Temp\Losis\" + sKey + ".wfifo");
   sw.WriteLine(FnString.Encode(sCommand));
   sw.Close();

   DownloadFile(@"C:\Temp\Losis\", sKey + ".wfifo", true);
  }
  else
  {
   StreamWriter sw = new StreamWriter(@"C:\Temp\Losis\" + sKey + ".wfifo_" + FnLOSIS.GetEnv().ToLower());
   sw.WriteLine(FnString.Encode(sCommand));
   sw.Close();

   DownloadFile(@"C:\Temp\Losis\", sKey + ".wfifo_" + FnLOSIS.GetEnv().ToLower(), true);
  }
  dbConn.Close();
 }

 protected void hbRefresh_Click(object sender, EventArgs e)
 {
  FnAdvChk fnAdvChk = new FnAdvChk(Context);

  FnAdvChk savefnAdvChk = (FnAdvChk)Session["ACfnAdvChk"];
 
  fnAdvChk.c_dtEndTime = savefnAdvChk.c_dtEndTime;
  fnAdvChk.c_dtStartTime = savefnAdvChk.c_dtStartTime;
  fnAdvChk.c_iLnSubNo = savefnAdvChk.c_iLnSubNo;
  fnAdvChk.c_sDistCode = savefnAdvChk.c_sDistCode;
  fnAdvChk.c_sLID = savefnAdvChk.c_sLID;
  fnAdvChk.c_sNAStCode = savefnAdvChk.c_sNAStCode;
  fnAdvChk.c_sSN = savefnAdvChk.c_sSN;
  fnAdvChk.c_sStreetCode = savefnAdvChk.c_sStreetCode;

  if (sAction == null || !sAction.Equals("Checking"))
  {
   CheckBoxList lbCheckType = (CheckBoxList)Session["ACcbl"];
   bool rbSN = (bool)Session["ACrbSN"];
   bool rbDist = (bool)Session["ACrbDist"];
   bool rbSNAddr = (bool)Session["ACrbSNAddr"];
   bool rbSt = (bool)Session["ACrbSt"];
   bool rbLoc = (bool)Session["ACrbLoc"];
   bool rbNone = (bool)Session["ACrbNone"];

   DataTable c_tbl = null;

   if (lbCheckType.Items[0].Selected)
   {
    if (rbSN)
     c_tbl = fnAdvChk.SDNoSupply(false, true, false, false);
    else if (rbDist)
     c_tbl = fnAdvChk.SDNoSupply(false, false, false, true);
    else if (rbSNAddr)
     c_tbl = fnAdvChk.SDNoSupply(true, true, false, false);
    else if (rbSt)
     c_tbl = fnAdvChk.SDNoSupply(true, false, true, false);
    else if (rbLoc || rbNone)
     c_tbl = fnAdvChk.SDNoSupply(true, false, false, false);
    else
     c_tbl = fnAdvChk.SDNoSupply(false, false, false, false);
   }

   if (lbCheckType.Items[1].Selected)
   {
    DataTable dtTemp;

    if (rbSN)
     dtTemp = fnAdvChk.HVNoSupply(false, true, false, false, false);
    else if (rbDist)
     dtTemp = fnAdvChk.HVNoSupply(false, false, false, true, false);
    else if (rbSNAddr)
     dtTemp = fnAdvChk.HVNoSupply(true, true, false, false, false);
    else if (rbSt)
     dtTemp = fnAdvChk.HVNoSupply(true, false, true, false, false);
    else if (rbLoc || rbNone)
     dtTemp = fnAdvChk.HVNoSupply(true, false, false, false, false);
    else
     dtTemp = fnAdvChk.HVNoSupply(false, false, false, false, false);

    if (c_tbl == null)
     c_tbl = dtTemp;
    else if (dtTemp != null)
     foreach (DataRow row in dtTemp.Rows)
      c_tbl.ImportRow(row);
   }

   if (lbCheckType.Items[2].Selected)
   {
    DataTable dtTemp;

    if (rbSN)
     dtTemp = fnAdvChk.CaseNoSupply(false, true, false, false);
    else if (rbDist)
     dtTemp = fnAdvChk.CaseNoSupply(false, false, false, true);
    else if (rbSNAddr)
     dtTemp = fnAdvChk.CaseNoSupply(true, true, false, false);
    else if (rbSt)
     dtTemp = fnAdvChk.CaseNoSupply(true, false, true, false);
    else if (rbLoc || rbNone)
     dtTemp = fnAdvChk.CaseNoSupply(true, false, false, false);
    else
     dtTemp = fnAdvChk.CaseNoSupply(false, false, false, false);

    if (c_tbl == null)
     c_tbl = dtTemp;
    else if (dtTemp != null)
     foreach (DataRow row in dtTemp.Rows)
      c_tbl.ImportRow(row);
   }

   if (lbCheckType.Items[3].Selected)
   {
    DataTable dtTemp;
    if (rbSN)
     dtTemp = fnAdvChk.VoltDip(false, true, false, false);
    else if (rbDist)
     dtTemp = fnAdvChk.VoltDip(false, false, false, true);
    else if (rbSNAddr)
     dtTemp = fnAdvChk.VoltDip(true, true, false, false);
    else if (rbSt)
     dtTemp = fnAdvChk.VoltDip(true, false, true, false);
    else if (rbLoc || rbNone)
     dtTemp = fnAdvChk.VoltDip(true, false, false, false);
    else
     dtTemp = fnAdvChk.VoltDip(false, false, false, false);

    if (c_tbl == null)
     c_tbl = dtTemp;
    else if (dtTemp != null)
     foreach (DataRow row in dtTemp.Rows)
      c_tbl.ImportRow(row);
   }

   string sEnv = FnLOSIS.GetEnv();
   TraceEngine c_objCE = new TraceEngine(Context.Request.ServerVariables.Get("APPL_PHYSICAL_PATH") + @"xml\ce\swo43000.xml", sEnv);

   // SN Check Digit
   foreach (DataRow dr in c_tbl.Rows)
   {
    if (dr["nature_cct"].ToString().StartsWith("SN"))
    {
     string[] asSN = FnLOSIS.GetSNSiteLabel(new string[] { dr["nature_cct"].ToString() }, c_objCE);
     dr["nature_cct"] = asSN[0].ToString();
    }
   }

   c_tbl.DefaultView.Sort = "type ASC, start_time DESC, status_ss ASC ";

   Session.Add("AdvSearchResult", c_tbl.DefaultView.ToTable());
   rgAdvSearch.DataSource = (DataTable)Session["AdvSearchResult"];
   rgAdvSearch.Rebind();
  }
  else
  {
   DataTable dtTable = fnAdvChk.SDNoSupply(FnAdvChk.QueryLvl.LV1);
   DataTable dtTemp = fnAdvChk.CaseNoSupply(FnAdvChk.QueryLvl.LV1);

   if (dtTable == null)
    dtTable = dtTemp;
   else if (dtTemp != null)
    foreach (DataRow row in dtTemp.Rows)
     dtTable.ImportRow(row);

   dtTemp = fnAdvChk.HVNoSupply(FnAdvChk.QueryLvl.LV1, false);

   if (dtTable == null)
    dtTable = dtTemp;
   else if (dtTemp != null)
    foreach (DataRow row in dtTemp.Rows)
     dtTable.ImportRow(row);

   dtTemp = fnAdvChk.VoltDip(FnAdvChk.QueryLvl.LV1);

   if (dtTable == null)
    dtTable = dtTemp;
   else if (dtTemp != null)
    foreach (DataRow row in dtTemp.Rows)
     dtTable.ImportRow(row);

   dtTable.DefaultView.Sort = "type ASC, start_time DESC, status_ss ASC";

   lblSelCriteria.Text = ((String)Session["SelCriteria"]);

   Session.Add("AdvSearchResult", dtTable.DefaultView.ToTable());
   rgAdvSearch.DataSource = dtTable;
   rgAdvSearch.Rebind();
  }

  UpdateRecNo();
 }

 protected void pbBack_Click(object sender, EventArgs e)
 {
  Response.Redirect("LOSISAdvanceChk.aspx");
 }
}

----------------------------------------------------------------------------------------------------------------------------------------------------------------
0
Jeff Tang
Top achievements
Rank 1
answered on 05 Jun 2009, 01:42 AM
I have tried to turn off the client settings for allow row select  ---->      <Selecting AllowRowSelect="true" />
The performance get back to normal, but it's a must for me to allow row selection. And my data usually over 200 rows.
0
Jeff Tang
Top achievements
Rank 1
answered on 05 Jun 2009, 01:59 AM
My latest is that when I keep turn on the client settings for allow row select, but turn off allow mutlple row select, the performace back to normal. In fact the problem I met is that the speed is very slow when I click on one row.
0
Tsvetoslav
Telerik team
answered on 05 Jun 2009, 12:25 PM
Hi Jeff Tang,

Could you try setting the table-layout style property of the outermost table to fixed:

<table width="100%" style="table-layout:fixed">  
 
</table> 
and let us know of the result.

Thank you.

Best wishes,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Jeff Tang
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Jeff Tang
Top achievements
Rank 1
Share this question
or