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

Server-side Row Selection with EditMode

3 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bahram
Top achievements
Rank 2
Bahram asked on 16 Feb 2012, 03:06 PM
Hello everybody,
I am using a grid with Server side selection as the same as Q1,2011 release demo(Grid/Selecting/Sever-Side Row Selection).
But I added this column to RadGrid to  have edit mode too.

 

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"
<ItemStyle CssClass="MyImageButton" /> 
 </telerik:GridEditCommandColumn>

 

But when I click on edit ImageButton it dose not preserve the selected row states and all checkBox return to unchecked State.Is there any way to preserve the state in edit mode?

I tried to add eventHandler in ItemCreated  like this

 

 

if (e.Item is GridDataItem) 
{
e.Item.PreRender += 
new EventHandler(RadGrid1_ItemPreRender); 
}

 

and

   
private void RadGrid1_ItemPreRender(object sender, EventArgs e) 
{
((sender 
as GridDataItem)["CheckBoxTemplateColumn"].FindControl("CheckBox1") as CheckBox).Checked = (sender as GridDataItem).Selected; 
}

 but it didnt fire at edit time.

 Sincerely yours,
Bahram.
 

 

3 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 16 Feb 2012, 10:43 PM
Bahram

I would suggest that you take a look at the Persisting CheckBox control state in GridTemplateColumn on rebind documentation page for insights here. Be sure to click the C# tab to see the server-side code required.

Hope this helps!
0
Bahram
Top achievements
Rank 2
answered on 17 Feb 2012, 03:51 PM
Hi jumpStart,
Thank you for your attention,
But I get error on this page , and the link dose not work,

With Regards ,
Bahram.
0
Richard
Top achievements
Rank 1
answered on 17 Feb 2012, 04:59 PM
Bahram:

The link works for me. Try it again. But, otherwise, it simply directs you to the online documentation for ASP.NET AJAX RadGrid and points to the Persisting CheckBox control state in GridTemplateColumn on rebind documentation page that is in the "RadControls/RadGrid/How To" folder. Then, click the C# tab for code behind.

Regards,
Tags
Grid
Asked by
Bahram
Top achievements
Rank 2
Answers by
Richard
Top achievements
Rank 1
Bahram
Top achievements
Rank 2
Share this question
or