ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Anyway to make manage Grid row Link Button state from data value ?
Title:
B
I
{code}
?
Hi, I would like to manage custom Grid row button like Edit, Delete or DoCustomAction state (Enable / Disable) depending of Data Value. I tried using ClientFormat but looks like JavaScript happens too early. I struggle to name the button to retrieve it from JQuery as the button exists multiple time in the Grid as Css class too. My button must be a link (href) ex: `<a href='${@Url.Action("ProcessSmsInfo", "Sms", new { id = ".Id" })}' class='awe-btn fa fa-th-list fa-2x btn-sms' ></a>` how can I take the model.Id to pass it in the new {id = ".Id"} ? Any solution would be useful from me. Txs in advance
Save Changes
Cancel
vRITHNER
asked at 02 May 2018
Answers
B
I
{code}
?
you can use `ClientFormatFunc` to define a js function that will generate the button html new Column { ClientFormatFunc = "getBtn" }, and the js function: function getBtn(model) { if (model.Price > 20) return 'Edit'; // disabled link = just text return '<a class="awe-btn" href="@Url.Action("ProcessSmsInfo", "Sms")?id=' + model.Id + '">Edit</button>'; }
Save Changes
Cancel
Omu
answered at 02 May 2018
Everything is working fine now. Txs very much for the assist
at 02 May 2018
vRITHNER
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