This question is locked. New answers and comments are not allowed.
Hi,
with grid popup edit, i add same checkbox to model editor template with name and value, but all values of checkbexes is converted to true, false, dependent on i check it.
But i want send my values.
Thx for help
LudvÃk Prouza
with grid popup edit, i add same checkbox to model editor template with name and value, but all values of checkbexes is converted to true, false, dependent on i check it.
But i want send my values.
Thx for help
LudvÃk Prouza
8 Answers, 1 is accepted
0
Dadv
Top achievements
Rank 1
answered on 02 Apr 2012, 01:45 PM
Can you give us some sample code?
0
Ludvík
Top achievements
Rank 1
answered on 03 Apr 2012, 02:28 AM
Hi,
i create simpli sample code. Click add new record and select value1, value2. Click insert. In Join collection see true, true, but expected value1, value2.
Regads
LudvÃk Prouza
i create simpli sample code. Click add new record and select value1, value2. Click insert. In Join collection see true, true, but expected value1, value2.
Regads
LudvÃk Prouza
0
Dadv
Top achievements
Rank 1
answered on 03 Apr 2012, 02:31 PM
This seem to be a Telerik problem, the submit action in the insert/edit content is warp by Telerik core and they take the Checked attribute as value (and take a simple value instead of the N value from the form).
You should send a PITS ticket because this is a different behavior from the normal MVC comportment.
In Normal MVC :
<input name='MyProperty' type="checkbox" checked="checked" value="MyValue1" />
<input name='MyProperty' type="checkbox" checked="checked" value="MyValue2" />
<input name='MyProperty' type="checkbox" value="MyValue3" />
will output in a POST form => ?MyProperty=MyValue1&MyProperty=MyValue2
Telerik Form for the same 3 input => ?MyProperty=false (where are the other values?)
This is because the submit button is not a "real" submit button : <a class="t-button t-grid-insert" href="#">Insert</a>
The submit is probably done in jquery and the data are "extract" from the form (normal posting should gave the first result).
I tested to change on the fly the initial form from telerik by an other from normal mvc Ajax call, and the submit property are : MyProperty=MyValue1&MyProperty=MyValue2 like expected.
I think there are some where in a JS a function that extract the input, and when it see a checkbox, it take the checked state and transmit it (this is not a bad thing in certain circumstances). perhaps the Team could add a method to let the user choose what he want to take (value or check state)?
PS: Ludvik be careful your DataModel template is a View and should be a PartialView and you use Server Binding AND Ajax binding in the same time.
You should send a PITS ticket because this is a different behavior from the normal MVC comportment.
In Normal MVC :
<input name='MyProperty' type="checkbox" checked="checked" value="MyValue1" />
<input name='MyProperty' type="checkbox" checked="checked" value="MyValue2" />
<input name='MyProperty' type="checkbox" value="MyValue3" />
will output in a POST form => ?MyProperty=MyValue1&MyProperty=MyValue2
Telerik Form for the same 3 input => ?MyProperty=false (where are the other values?)
This is because the submit button is not a "real" submit button : <a class="t-button t-grid-insert" href="#">Insert</a>
The submit is probably done in jquery and the data are "extract" from the form (normal posting should gave the first result).
I tested to change on the fly the initial form from telerik by an other from normal mvc Ajax call, and the submit property are : MyProperty=MyValue1&MyProperty=MyValue2 like expected.
I think there are some where in a JS a function that extract the input, and when it see a checkbox, it take the checked state and transmit it (this is not a bad thing in certain circumstances). perhaps the Team could add a method to let the user choose what he want to take (value or check state)?
PS: Ludvik be careful your DataModel template is a View and should be a PartialView and you use Server Binding AND Ajax binding in the same time.
0
Ludvík
Top achievements
Rank 1
answered on 04 Apr 2012, 04:42 AM
Hello
Thanks for the explanation, I came to a similar conclusion. As a solution, I moved on to edit the checkboxes to another window that I open with custom command.
DataModel editor I created as View mistake but because it worked so I did not change.
Is there any problem with the using server binding AND Ajax Binding at the same time? I do normally use for faster display table contents when the page loads.
Thanks for the explanation, I came to a similar conclusion. As a solution, I moved on to edit the checkboxes to another window that I open with custom command.
DataModel editor I created as View mistake but because it worked so I did not change.
Is there any problem with the using server binding AND Ajax Binding at the same time? I do normally use for faster display table contents when the page loads.
0
Dadv
Top achievements
Rank 1
answered on 04 Apr 2012, 08:31 AM
It's not really a problem but often the issues post on the forum are because of this mix.
If you use Server and client binding, you need to remember that every .ClientTemplate should have is parity in .Template too.
If you use Server and client binding, you need to remember that every .ClientTemplate should have is parity in .Template too.
0
Hello,
The Grid uses the checked state to set the value when using Ajax binding in order to support editing boolean fields with checkboxes. The value will be send when using Server editing. When using Ajax editing, you could set the checkbox value instead of the checked state in the OnSave client-side event e.g.
I hope this helps.
All the best,
Daniel
the Telerik team
The Grid uses the checked state to set the value when using Ajax binding in order to support editing boolean fields with checkboxes. The value will be send when using Server editing. When using Ajax editing, you could set the checkbox value instead of the checked state in the OnSave client-side event e.g.
function onSave(e) { $(e.form).find(":checkbox").each(function () { e.values[this.name] = $(this).val(); });}All the best,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Dadv
Top achievements
Rank 1
answered on 04 Apr 2012, 04:40 PM
Great workaround thanks, did the team plan to add a method for that in the future?
0
Hello,
Currently, we don't plan to add support for using the checkbox value instead of the state. I logged it in our system and if more users request this functionality, we will schedule it for further investigation and consider to implement it for a future release.
All the best,
Daniel
the Telerik team
Currently, we don't plan to add support for using the checkbox value instead of the state. I logged it in our system and if more users request this functionality, we will schedule it for further investigation and consider to implement it for a future release.
All the best,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.