web db responsive grid item template html

Hi
I need to make a condition in html template
and that not work
please guide me

<script type="text/javascript">
if ((%discount%)>0)  
{ document.write(<br><B>discount (%discount%) %</B>) }
</script>

Scripts inserted this way aren't run automatically.
Not sure why you need JavaScript for this as TMS WEB Core is all about enabling you to write your client side code all in Object Pascal.
You could implement the OnItemCreated event and from there dynamically change the item content via code in the event handler.

Hi dear Bruno
I wanna create shopping web site
and i need to show discount
just when discount>0
and that did not work
in any html condition way

I don't understand how you cannot use OnItemCreated as from this event you can dynamically change the HTML and display a discount or not for example.

Sample code:

procedure TForm1.WebResponsiveGrid1ItemCreated(Sender: TObject; Index: Integer);
begin
  if discount > 0 then
    WebResponsiveGrid1.Items[Index].ElementHandle.innerHTML := YOURHTMLWITHDISCOUNT
  else
    WebResponsiveGrid1.Items[Index].ElementHandle.innerHTML := YOURHTMLWITHOUTDISCOUNT;
end;

Ok , Thanks a lot mr Brono.