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

[Solved] issues when disabling grid controls

4 Answers 169 Views
Grid
This is a migrated thread and some comments may be shown as answers.
newbie
Top achievements
Rank 1
newbie asked on 15 May 2008, 04:38 PM
I have a master detail grid along with some controls and edit button on the form.
I render my controls in view only mode and on click of edit button they are enabled.

I recursively disable the controls on page load and then recursively enable them on edit button click.

something like :

public

void DisableEditableControls(ControlCollection controls)

{

Type[] interfaces;
{
Type t = control.GetType();


if

(t.Name == typeof(RadGrid).Name)

{

RadGrid radGrid = (RadGrid)control;

radGrid.MasterTableView.CommandItemDisplay =

GridCommandItemDisplay.None;

radGrid.Columns.FindByUniqueNameSafe(

"EditCommandColumn").Display = false;

radGrid.Columns.FindByUniqueNameSafe(

"DeleteColumn").Display = false;

DisableEditableControls(radGrid.Controls);

if (radGrid.MasterTableView.HasDetailTables)

{

foreach (GridTableView gtv in radGrid.MasterTableView.DetailTables)

{

gtv.CommandItemDisplay =

GridCommandItemDisplay.None;

gtv.Columns.FindByUniqueNameSafe(

"EditCommandColumn").Display = false;

gtv.Columns.FindByUniqueNameSafe(

"DeleteColumn").Display = false;

gtv.Columns.FindByUniqueNameSafe("SelectColumn").Display = false;
DisableEditableControls(gtv.Controls);

}

}

continue;

}
}

The problem I am facing is I have a client select(for multiple rows) column, and when my controls are enabled the checkboxes still show disabled.if I do any operation on the grid like a sort, the check box is enabled.
Why is this happening?

Please let me know what am I missing here?

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 May 2008, 07:37 AM
Hi Newbie,

Try Rebinding the Grid after enabling the controls.

RadGrid1.rebind(); 

Thanks
Shinu.
0
newbie
Top achievements
Rank 1
answered on 16 May 2008, 04:15 PM
that does not work.
it still renders as disabled when I click the dit button to enable the controls.
It gets enabled only when i do an operation like a sort.
0
Princy
Top achievements
Rank 2
answered on 19 May 2008, 07:13 AM
Hi Newbie,

How are you binding the Grid? Try using AdvanceDataBinding techniques to bind the Grid.
RadGrid for ASP.NET AJAX

Princy.
0
newbie
Top achievements
Rank 1
answered on 19 May 2008, 04:08 PM
I am using the needdataSource event and I do not explicitly use dataBind() on the grid.
Tags
Grid
Asked by
newbie
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
newbie
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or