Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1510
Grid re-loads the FIRST time I push the [+] in a Hierarchial Grid
posted

Hi there!

Can you please tell me why the WebGrid reloads ONCE ( the first time ) when I push the [+] to get the children for parent row ? This only happens ONCE ... and after I that I try other [+] and it works like a charm WITHOUT refreshing the Grid ?? The [+]'s are always rembered as opened for each line ( which is good )

rgd,
EE.

This is the code for the Grid:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

using

 

 

System;

using

 

 

System.Collections.Generic;

using

 

 

System.Linq;

using

 

 

System.Web;

using

 

 

System.Web.UI;

using

 

 

System.Web.UI.WebControls;

using

 

 

IsIt.Tracking.Service;

using

 

 

IsIt.Tracking.DataTypes;

using

 

 

IsIt.Tracking.Utils;

using

 

 

System.DirectoryServices.AccountManagement;

//using KBBanki.Common;

namespace

 

 

IsIt.Tracking

{

 

 

public partial class Default : System.Web.UI.

Page

{

 

 

private SortableCollection<AKTransactionTrack

> _transactions;

 

 

private SortableCollection<AKTrackOneToMany

> _transactionsOneToMany;

 

 

protected void Page_Load(object sender, EventArgs

e)

{

 

 

if

(!Page.IsPostBack)

{

System.Security.Principal.

 

WindowsIdentity identity = System.Security.Principal.WindowsIdentity

.GetCurrent();

System.Security.Principal.

 

WindowsPrincipal user = new System.Security.Principal.WindowsPrincipal

(identity);

 

 

if (!user.IsInRole("IS-KIS-ACL-Tracking-User"

))

{

 

 

TrackingService.ErrorLoggingWhenAccessingPage();

//creates an entry for LogViewer

Response.Redirect(

 

"AccessDenied.aspx"

);

}

 

 

//_ugTransactions.DisplayLayout.LoadOnDemand = Infragistics.WebUI.UltraWebGrid.LoadOnDemand.Automatic;

 

 

//_ugTransactions.EnableViewState = false;

_ugTransactions.DisplayLayout.ViewType = Infragistics.WebUI.UltraWebGrid.

 

ViewType

.Hierarchical;

 

 

//_ugTransactions.Browser = Infragistics.WebUI.UltraWebGrid.BrowserLevel.Auto;

 

 

//_ugTransactions.DisplayLayout.Pager.AllowPaging = true;

 

 

//_ugTransactions.DisplayLayout.Pager.PageSize = 100;

}

 

 

/*_tbBankanumer.Text = "0329";

_tbHofudbok.Text = "26";

_tbReikningur.Text = "456998";*/

}

 

 

protected void _btnSearch_Click(object sender, EventArgs

e)

{

 

 

if ((_tbBankanumer.Text == string.Empty) || (_tbHofudbok.Text == string.Empty) || (_tbReikningur.Text == string

.Empty))

{

_lblBankanumerHofudbokReikningur.Text =

 

"Please don't leave Bankanmer, Hfubk or Reikningur empty - too much data to export to Excel!"

;

 

 

return

;

}

 

 

//1/1/1753 12:00:00 AM and 12/31/9999

 

 

DateTime dagsFra = new DateTime

(1753, 1, 1);

 

 

DateTime dagsTil = new DateTime

(9999, 12, 31);

 

 

string

bankanumer = _tbBankanumer.Text.Trim();

 

 

if

(bankanumer.Length == 3)

bankanumer =

 

"0"

+ bankanumer;

 

 

string

hofudbok = _tbHofudbok.Text.Trim();

 

 

string

reikningsnumer = _tbReikningur.Text.Trim();

 

 

if (_dateDagsetningFra.Value != null

)

dagsFra = (

 

DateTime

)_dateDagsetningFra.Value;

 

 

if (_dateDagsetningTil.Value != null

)

dagsTil = (

 

DateTime

)_dateDagsetningTil.Value;

 

 

try

{

_transactions =

 

TrackingService

.GetAllAKTransactionTracksBySearchCriteria(bankanumer, hofudbok, reikningsnumer, dagsFra, dagsTil);

}

 

 

catch (Exception

ex)

{

 

 

//Exceeds the maximum rows able to databind:

 

 

if (ex.Message == "More than 5.000 results! Please narrow the search dates for fewer results"

)

{

_lblBankanumerHofudbokReikningur.Text = ex.Message;

_ugTransactions.Rows.Clear();

_lblRows.Text =

 

"Frslur r leit: "

;

_lblRowCount.Text = _ugTransactions.Rows.Count.ToString();

 

 

Logger logger = getLoggingDetails("RB Frslur", "Search for data"

);

 

 

TrackingService

.LogIntoDatabase(logger);

Cache.Remove(

 

"dataFromGrid"

);

}

 

 

return

;

}

 

 

if (_transactions != null

)

{

Cache[

 

"dataFromGrid"

] = _transactions;

 

 

if

(_transactions.Count > 0)

{

_ugTransactions.DataSource = _transactions;

_ugTransactions.DataBind();

 

//this will throw 'System.OutOfMemoryException' !!!!!

}

}

_lblRows.Text =

 

"Frslur r leit: "

;

_lblRowCount.Text = _ugTransactions.Rows.Count.ToString();

 

 

Logger log = getLoggingDetails("RB Frslur", "Search for data"

);

 

 

TrackingService

.LogIntoDatabase(log);

_lblBankanumerHofudbokReikningur.Text =

 

String

.Empty;

}

 

 

protected void _btnExcelExport_Click(object sender, EventArgs

e)

{

UltraWebGridExcelExporter1.ExportMode = Infragistics.WebUI.UltraWebGrid.ExcelExport.

 

ExportMode

.Download;

 

 

if (Cache["dataFromGrid"] != null

)

{

_transactions = (

 

SortableCollection<AKTransactionTrack>)Cache["dataFromGrid"

];

 

 

if (_transactions != null && _lblRowCount.Text != String

.Empty)

{

 

 

if

(_transactions.Count > 0)

{

_ugTransactions.DataSource = _transactions;

_ugTransactions.DataBind();

UltraWebGridExcelExporter1.Export(_ugTransactions);

 

 

Logger log = getLoggingDetails("RB Frslur", "Excel export"

);

 

 

TrackingService

.LogIntoDatabase(log);

}

}

}

 

 

else

 

 

return

;

}

 

 

private Logger getLoggingDetails(string gridName, string

typeOfOperation)

{

 

 

DateTime dagsFra = new DateTime

(1753, 1, 1);

 

 

DateTime dagsTil = new DateTime

(9999, 12, 31);

 

 

Logger log = new Logger

();

log.Bankanumer = _tbBankanumer.Text.Trim();

log.Hofudbok = _tbHofudbok.Text;

System.Security.Principal.

 

WindowsIdentity identity = System.Security.Principal.WindowsIdentity

.GetCurrent();

System.Security.Principal.

 

WindowsPrincipal user = new System.Security.Principal.WindowsPrincipal

(identity);

 

 

 

//KBBanki.Common.UserDetails userInfo = new UserDetails(System.Security.Principal.WindowsIdentity.GetCurrent().Name);

 

 

//log.FullName = userInfo.FullName;

log.LoginId = identity.Name;

log.RecordsCount =

 

Int32

.Parse(_lblRowCount.Text);

log.Reikningsnumer = _tbReikningur.Text.Trim();

log.TypeOfOperation = typeOfOperation;

 

 

if (_dateDagsetningFra.Value != null

)

dagsFra = (

 

DateTime

)_dateDagsetningFra.Value;

 

 

if (_dateDagsetningTil.Value != null

)

dagsTil = (

 

DateTime

)_dateDagsetningTil.Value;

log.DagsetningFra = dagsFra;

log.DagsetningTil = dagsTil;

log.GridName = gridName;

 

 

return

log;

}

 

 

protected void _ugTransactions_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs

e)

{

e.Layout.Bands[0].AllowSorting = Infragistics.WebUI.UltraWebGrid.

 

AllowSorting

.OnClient;

e.Layout.Bands[0].AllowColSizing = Infragistics.WebUI.UltraWebGrid.

 

AllowSizing

.Fixed;

e.Layout.Bands[0].AllowColumnMoving = Infragistics.WebUI.UltraWebGrid.

 

AllowColumnMoving

.None;

e.Layout.Bands[0].Columns.FromKey(

 

"TransTrackId").Hidden = true

;

e.Layout.Bands[0].Columns.FromKey(

 

"KeyrtIVoruhus").Hidden = true

;

e.Layout.Bands[0].Columns.FromKey(

 

"Bankanumer").Header.Caption = "Banki"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Bankanumer"

).Width = 50;

e.Layout.Bands[0].Columns.FromKey(

 

"Hofudbok").Header.Caption = "HB"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Hofudbok"

).Width = 20;

e.Layout.Bands[0].Columns.FromKey(

 

"Reikningsnumer").Header.Caption = "Reikningsnmer"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Faerslulykill").Header.Caption = "Frsulykill"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Faerslulykill"

).Width = 60;

e.Layout.Bands[0].Columns.FromKey(

 

"Upphaed").Header.Caption = "Upph"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Textalykill").Header.Caption = "Textalykill"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Tekkanumer").Header.Caption = "Tkkanmer"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Tilvisun").Header.Caption = "Tilvsun"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Faersludagur").Header.Caption = "Frsludagur"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Innlausnarbanki").Header.Caption = "Innlausnarbanki"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Bunkanumer").Header.Caption = "Bunkanmer"

;

e.Layout.Bands[0].Columns.FromKey(

 

"TegundInntaks").Header.Caption = "TegundInntaks"

;

e.Layout.Bands[0].Columns.FromKey(

 

"RBMatchStatus").Header.Caption = "RBMatchStatus"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotBankanumer").Header.Caption = "MtBankanmer"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotHofudbok").Header.Caption = "MtHfubk"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotReikningsnumer").Header.Caption = "MtReikningsnmer"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotFaerslulykill").Header.Caption = "MtFrslulykill"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotTextalykill").Header.Caption = "MtTextalykill"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotTekkanumer").Header.Caption = "MtTkkanmer"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotTilvisun").Header.Caption = "MtTilvsun"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotBunkanumer").Header.Caption = "MtBunkanmer"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotKennitala").Header.Caption = "MtKennitala"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotNafn").Header.Caption = "MtNafn";

//Mtnafn

e.Layout.Bands[0].Columns.FromKey(

 

"AKMatchStatus").Header.Caption = "AKMatchStatus"

;

e.Layout.Bands[0].Columns.FromKey(

 

"AKMatchRunDate").Header.Caption = "AKMatchRunDate"

;

e.Layout.Bands[0].Columns.FromKey(

 

"IBASMatchStatus").Header.Caption = "IBASMatchStatus"

;

e.Layout.Bands[0].Columns.FromKey(

 

"IBASMatchRunDate").Header.Caption = "IBASMatchRunDate"

;

e.Layout.Bands[0].Columns.FromKey(

 

"Reiknnumid").Header.Caption = "Reiknnumid"

;

e.Layout.Bands[0].Columns.FromKey(

 

"MotReiknnumid").Header.Caption = "MtReiknnumid"

;

e.Layout.Bands[0].Columns.FromKey(

 

"TransTrackId"

).Move(0);

e.Layout.Bands[0].Columns.FromKey(

 

"Bankanumer"

).Move(1);

e.Layout.Bands[0].Columns.FromKey(

 

"Hofudbok"

).Move(2);

e.Layout.Bands[0].Columns.FromKey(

 

"Reikningsnumer"

).Move(3);

e.Layout.Bands[0].Columns.FromKey(

 

"Faerslulykill"

).Move(4);

e.Layout.Bands[0].Columns.FromKey(

 

"Upphaed"

).Move(5);

e.Layout.Bands[0].Columns.FromKey(

 

"MotBankanumer"

).Move(6);

e.Layout.Bands[0].Columns.FromKey(

 

"MotHofudbok"

).Move(7);

e.Layout.Bands[0].Columns.FromKey(

 

"MotReikningsnumer"

).Move(8);

e.Layout.Bands[0].Columns.FromKey(

 

"MotKennitala"

).Move(9);

e.Layout.Bands[0].Columns.FromKey(

 

"MotNafn"

).Move(10);

e.Layout.Bands[0].Columns.FromKey(

 

"Textalykill"

).Move(11);

e.Layout.Bands[0].Columns.FromKey(

 

"Tekkanumer"

).Move(12);

e.Layout.Bands[0].Columns.FromKey(

 

"Tilvisun"

).Move(13);

e.Layout.Bands[0].Columns.FromKey(

 

"Faersludagur"

).Move(14);

e.Layout.Bands[0].Columns.FromKey(

 

"Innlausnarbanki"

).Move(15);

e.Layout.Bands[0].Columns.FromKey(

 

"Bunkanumer"

).Move(16);

e.Layout.Bands[0].Columns.FromKey(

 

"TegundInntaks"

).Move(17);

e.Layout.Bands[0].Columns.FromKey(

 

"RBMatchStatus"

).Move(18);

e.Layout.Bands[0].Columns.FromKey(

 

"MotFaerslulykill"

).Move(19);

e.Layout.Bands[0].Columns.FromKey(

 

"MotTextalykill"

).Move(20);

e.Layout.Bands[0].Columns.FromKey(

 

"MotTekkanumer"

).Move(21);

e.Layout.Bands[0].Columns.FromKey(

 

"MotTilvisun"

).Move(22);

e.Layout.Bands[0].Columns.FromKey(

 

"MotBunkanumer"

).Move(23);

 

 

try

{

e.Layout.Bands[1].Columns.FromKey(

 

"Id").Hidden = true

;

e.Layout.Bands[1].Columns.FromKey(

 

"TransTrackId").Hidden = true

;

}

 

 

catch(Exception

){};

 

 

//e.Layout.Bands[1].Columns.FromKey("Gjaldkeri").Hidden this property is false at run time, as it should be!

 

 

//e.Layout.Bands[1].Columns.FromKey("Gjaldkeri").Visible this property is TRUE, as it should be ... although it's not displaying

}

}

}

 

 

 

Parents
  • 45049
    Suggested Answer
    posted

    EE,

    What is the value of your grid's DisplayLayout.LoadOnDemand property?  The behavior you're describing is correct behavior if this property is set to "Automatic".

    I notice that you have a commented-out setting of this property:

    eiki666 said:
    //_ugTransactions.DisplayLayout.LoadOnDemand = Infragistics.WebUI.UltraWebGrid.LoadOnDemand.Automatic;

Reply Children