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

Checkbox value not captured

11 Answers 150 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jack Ma
Top achievements
Rank 1
Jack Ma asked on 20 Apr 2010, 10:22 AM
Env (MVC2, C#,Extension 2010.1.416)

In grid, the boolean type property is bound to a checkbox column, I can show the value in checkbox at right status through either clienttemplate or onRowDataBound javascript function. But below two points are headaches,
1.Once switch to edit mode(click edit button on row), the checkbox status will be cleared by default, this is not user friendly, especially when just cancel this edit, the original state of the checkbox will be lost, means just left unchecked.
2.When click update, the checkbox state is not brought to the controller's method, means even the checkbox is checked, the value of the checkbox bound property is kept false. 

I have no idea how to fix these, i've read some thread from other users' post but no clear solution on this.  Is there any way to solve these or maybe can some setting just make the checkbox has right behavior?
Appreciate a lot in advance.

Regards
Jack  

11 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 20 Apr 2010, 11:35 AM
Hi Jack Ma,

We are not aware of those problems. I would appreciate if you send us a sample project.

Regards,
Atanas Korchev
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.
0
Jack Ma
Top achievements
Rank 1
answered on 20 Apr 2010, 02:39 PM
Hi Atanas,
    I just attached a simple test project in a rough to test the checkbox state in edit mode,but i can not attach it here as the extension only limit to image files. Oops...

Regards
Jack 
0
Jack Ma
Top achievements
Rank 1
answered on 20 Apr 2010, 02:47 PM
Hi Atanas,
    Maybe you can give me a sample on showing this. I don't see any example in your demo to show edit working with checkbox in grid. Don't know what is the right and best practice. 
    Your advice is very appreciated!

Regards
Jack
0
Atanas Korchev
Telerik team
answered on 20 Apr 2010, 03:01 PM
Hello Jack Ma,

Forum threads do not allow attachments. You can perhaps host your project somewhere.

There is a working sample attached in this forum thread - check my last reply.

Regards,
Atanas Korchev
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.
0
Jack Ma
Top achievements
Rank 1
answered on 21 Apr 2010, 07:01 AM
Hi Atanas,
    I've checked you refered project, yes, it's quite right in the editing behavior. Don't know why in my env it acts odd. 
    Once click edit, the previous status of the bool value will be lost, and once click update to invoke save method, the object transferred to controller does not have the right status though the checkbox has been checked. 

    In your example, the linq is used, and directly access the database through UI site. My scenario is just transferred the object to a WCF service and the service will do the right thing for me. But before that, the object being send is incorrect. Sad...
    I've applied the 2010.1.416 package of extension, but i'll try again to use the js file in your sample project.  

Regards
Jack
0
Jack Ma
Top achievements
Rank 1
answered on 21 Apr 2010, 08:24 AM
Hi Atanas,
    I've tried to replace the telerik.grid.editing.min.js with the one in your sample project, but still not act right. I found in my scripts folder, there's another file named telerik.grid.editing.js, and i tried to find the code snip you mentioned in previous context, and replace it with you mentioned code, this time when i click the edit button, the checkbox will keep the state it originally takes, but once I click the update to post or just click cancel  button, the checkbox will lost the state again nevertheless the checkbox is already checked or the original value is. 

  Actually, I'm quite confused with the js files inside the script folder, there're two js files with similiar name telerik.grid.editing, and even we got telerik.grid.js, what are they exactly for, do I need them all or depend on any cases? I saw your sample project even just has the telerik.grid.editing.min.js and it works fine. I'm totally lost.  

Regards
Jack 
0
Atanas Korchev
Telerik team
answered on 21 Apr 2010, 08:38 AM
Hello Jack Ma,

I am not sure what you have done. Anyway I am sending you the upgrade checkbox editing project which works as expected on my end. I cannot help you any further unless you provide a project which shows the problems you are having.

Regards,
Atanas Korchev
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.
0
Jack Ma
Top achievements
Rank 1
answered on 21 Apr 2010, 09:04 AM
Hi Atanas,
    I think I found something, in your sample project, even I omit the js content by add '//' in front of the script inside telerik.grid.editing.min.js, your sample will still work well, the checkbox state acts perfect as it desired whatever update or cancel button clicked. 
    But in my project, if I omit the telerik.grid.editing.min.js file, it does work in the right way, the checkbox will be the right behavior as desired no matter update or cancel is using. But the bad thing is, the grid will automatically refresh means it retrieve the data by posting request to server, hence, the grid other feature like onhover is missing at this situation. This is not what I want.

Regards
Jack
0
Atanas Korchev
Telerik team
answered on 21 Apr 2010, 09:08 AM
Hi Jack Ma,

As I repeatedly said we cannot help you further without reproducing the problem first. You cannot attach files to forum posts but you can host your project somewhere with public access so we can download it.

Regards,
Atanas Korchev
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.
0
Jack Ma
Top achievements
Rank 1
answered on 21 Apr 2010, 09:31 AM
Dear Atanas,
By replacing the whole scripts folder, I finally reach the target. It works well now.
Appreciated a lot!

Regards
Jack
0
Diiimo
Top achievements
Rank 1
answered on 08 Jul 2010, 12:33 PM
Hello Atanas,

the problem with the checkbox state already exists. i have modified your sample project.
I have 4 checkboxes but only two will be post to the controller method.

Regards,
Timo
Tags
Grid
Asked by
Jack Ma
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jack Ma
Top achievements
Rank 1
Diiimo
Top achievements
Rank 1
Share this question
or