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

CommandItemTemplate checkbox used to apply filter to grid and datasouruce

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Wired_Nerve
Top achievements
Rank 2
Wired_Nerve asked on 24 May 2010, 03:49 PM

I am using a commandItem Template.
In this row I have added a Show Inactive Checkbox. 
I need the check box to maintain view state when users filter items (see pic) and such. 
The story:

  1. A user has a list of sites, some have been set to inactive. 
  2. They need to see the inactive sites only.  Why-- to view some of the historical data for that inactive site.
  3. In the commandItem Template row I have a checkbox. 
  4. They click the check box and it autopostback and tells the datasource (linq to sql datasource) to only show inactive sites.
  5. They filter the list and the grid rebinds.
  6. The PROBLEM, everytime the grid rebinds the checkbox loses it viewstate.

I search the various online demos and I have not seen this type of example.. Anyone have an idea?

Warren LaFrance, Jr.
Hayes Software Systems, Inc.

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 27 May 2010, 02:06 PM
Hi Warren,

When RadGrid is rebound, all controls in it are recreated and appear with its initial state. Therefore to persist the CheckBox checked state, I suggest that in the CheckedChanged event save that state in ViewState for instance. Then in the CheckBox PreRender event handler, set its Checked property based on the ViewState field value.

I hope this works for you.

Best wishes,
Iana
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Wired_Nerve
Top achievements
Rank 2
Answers by
Iana Tsolova
Telerik team
Share this question
or