ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Grid - Conditional Checkbox
Title:
B
I
{code}
?
I see Grid with checkboxes samople https://demo.aspnetawesome.com/GridCheckboxesDemo#Grid-with-checkboxes-that-persist-state-when-paging is it possible to show checkboxes conditioned to the status of another field ?
Save Changes
Cancel
mtugnoli
asked at 21 Sep 2018
Answers
B
I
{code}
?
you can by using `ClientFormatFunc` instead of `ClientFormat`, here's an example using our demo: new Column { Width = 40, ClientFormatFunc = "getChk", ... and the js function: @{ var chkstr = Html.Awe().CheckBox("Id").Ochk().Prefix("c.(Id)").SyncScript() .HtmlAttributes(null, new {data_val = ".(Id)"}).ToString(); } var chkstr = @Html.Raw(DemoUtils.Encode(chkstr)); function getChk(item) { if (item.Person.length > 5) { return chkstr.split('.(Id)').join(item.Id); } return ''; }
Save Changes
Cancel
Omu
answered at 21 Sep 2018
2 problems ... 1) this row gime me some errors ... var chkstr = @Html.Raw(DemoUtils.Encode(chkstr)); see http://www.caivola.it/files/error.png 2) in rows without checkbox is still possible to select the row, is alsp possible to disable selection conditionally ?
at 24 Sep 2018
Meccanica Rossi
the code provided was copied from our demo, you can try to download the latest demo and put this code in there
at 24 Sep 2018
Omu
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK