Datagrid Advice

Discussion in 'ASP .Net Datagrid Control' started by Jeremy Martin, May 29, 2006.

  1. Hi,

    I have a Master Detail Detail DataGrid which is setup like a dynamic
    score card. The user clicks on the score "DataCell" and it fires a JS
    onclick event which sets the property of a Hidden Input Type and
    displays an appropriate image. "Visual representation of a mark eg tick
    cross"

    Now there us usually a couple of hundred possibilities on the form and
    I cannot use Paging on the grid.


    Example of HTML output of a Hidden Tag

    <input name="TPG:_ctl9:pAG:_ctl3:pOG:_ctl2:1imgMark_h"
    id="TPG__ctl9_PAG__ctl3_POG__ctl2_1imgMark_h" type="hidden" value="0" />


    This setup works really well except for a couple of problems.

    1. The viewstate is huge ~200K. I currently override the
    SavePageStateToPersistenceMedium procedure and store it in a
    SQLDatabase along with my Session Data. However I found that it takes
    rougly 1 second to serialize and deserialize and uses alot of
    processing power.

    My alternative was download the whole Viewstate but on postback i got
    viewstate corrupt errors.


    2. I tried disabling the viewstate which ofcourse helps but now my
    results do not get posted back and saved.


    So I suppose the questions I have are.

    Can I shrink the viewstate somehow by not storing everything about the
    datagrid

    OR

    Should I be using an alternative method to save my results. Currently I
    am doing below on OnInit whenever they click the save button. However
    when ViewState is disabled on the datagrid none of items or controls
    are available on PostBack.



    for i := 0 to self.Items.Count -1 do
    Begin
    If (self.Items.itemType = ListItemType.Item) OR
    (self.Items.itemType = ListItemType.AlternatingItem) OR
    (self.Items.itemType = ListItemType.SelectedItem) Then
    Begin

    drp := self.Items.FindControl('OUTCOME_ATTITUDE') as
    DropDownList;
    if Assigned(drp) then
    PriOutcomes :=
    TPriOutcomes(OutComeData.Item[self.Items.ItemIndex]);
    if PriOutcomes.Attitude then
    PriOutcomes.Behaviour := drp.SelectedIndex;

    PriOutcomes :=
    TPriOutcomes(OutComeData.Item[self.Items.ItemIndex]);
    for i2 := 3 to self.Columns.Count -1 do
    Begin
    placeholder := self.Items.Cells[i2].Controls[0] as
    System.Web.UI.WebControls.PlaceHolder;
    hid := placeholder.Controls[0] as
    System.Web.UI.HtmlControls.HtmlInputHidden;
    ViewState[hid.ClientID] := hid.Value;
    levelidx := i2 - 2;
    try
    PriMark :=
    (PriOutcomes.GetProperty('Level'+levelidx.ToString) as TPRIMark);
    except
    PriMark := (PriOutcomes.GetProperty('LevelNA') as TPRIMark);
    end;
    if (Assigned(PriMark)) then
    if (hid.Value <> '0') and (hid.Value <> '') then
    PriMark.FChecked := True
    else
    PriMark.FChecked := False;
    End;
    end;


    Any advice on this one is greatly appreciated.
    Cheers
    Jeremy
    Jeremy Martin, May 29, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Asun Friere
    Replies:
    1
    Views:
    489
    Paul Boddie
    Aug 27, 2003
  2. Peter Hansen
    Replies:
    23
    Views:
    855
    Anton Vredegoor
    Sep 5, 2003
  3. Gerrit Holl
    Replies:
    16
    Views:
    607
    Tom Plunket
    Aug 29, 2003
  4. Asun Friere
    Replies:
    0
    Views:
    470
    Asun Friere
    Aug 28, 2003
  5. Michele Simionato
    Replies:
    2
    Views:
    379
    Jacek Generowicz
    Sep 1, 2003
Loading...

Share This Page