This topic is locked
[SOLVED]

 Conditional Text formatting on "VIEW" ASPRunner.NET 9.8

2/9/2018 2:29:10 PM
ASPRunner.NET General questions
N
nfgcgrb author

I'm working on a site to store and manage job descriptions, they will be displayed as a VIEW, when a specific value A = 'Y' then I want the text in field B to be Bold Red, if not, normal text.
ASPRUNNER.NET V9.8 on Windows 7 running on an IIS Windows server and Microsoft SQL database

jadachDevClub member 2/9/2018

If you are using the view page, do this:
On the before display event of the view page you need to set a proxy value.

pageObject.setProxyValue("ValueA", values["ValueA"]);


Now that you have that value, you can use it in the JavaScript Onload Event.

var ctrlValueA = Runner.getControl(pageid, 'ValueA');

var ctrlFieldB = Runner.getControl(pageid, 'FieldB');
if(proxy['ValueA']=="Y"){

ctrlFieldB.addStyle('color: red;');

}
admin 2/12/2018

Just wanted to add that using 'View as' Custom can be more convenient in some cases as it will be automatically applied to both List and View pages:

https://xlinesoft.com/asprunnernet/docs/conditional_formatting.htm

N
nfgcgrb author 2/12/2018



If you are using the view page, do this:
On the before display event of the view page you need to set a proxy value.

pageObject.setProxyValue("ValueA", values["ValueA"]);


Now that you have that value, you can use it in the JavaScript Onload Event.

var ctrlValueA = Runner.getControl(pageid, 'ValueA');

var ctrlFieldB = Runner.getControl(pageid, 'FieldB');
if(proxy['ValueA']=="Y"){

ctrlFieldB.addStyle('color: red;');

}



That worked great, Thank you so much!