ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Custom format using template func value showing up null
Title:
B
I
{code}
?
Hello, when I use this code: new Column { ClientFormatFunc = "useTemplate('commentTemplate')", Header="Comments" } ... <div id="commentTemplate" style="display:none"> .Comment1 <br/> .Comment2 <p style="color:blue"> .TestCom </p> </div> It works great if there is a comment(s). The problem is that when there is not a comment, the value shows up "null" in the table. The word "null" actually appears. How can I prevent the "null" value from showing up when the Comment1-2-Tester is null?
Save Changes
Cancel
eliawesome
asked at 08 Feb 2019
Answers
B
I
{code}
?
I presume you copied the `useTemplate` function from our demo; modify it with this code: for (var name in model) { var val = model[name]; if (val == null) val = ''; str = str.replace("." + name, val); }
Save Changes
Cancel
Omu
answered at 08 Feb 2019
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