Row_rendered server event

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
ashworth81
User
Posts: 11

Row_rendered server event

Post by ashworth81 »

Hi,

trying to amend row attributes based on values.

Noticed this in the help file...

// Change the row color in List page
 if (ew_SameStr(Trademark.ViewValue, "BMW"))
     RowAttrs["style"] = "color: red; background-color: #ccffcc";

How can I amend this code for when I have 2 conditions and one of the conditions is a 'if greater than' statement.

I need something like...

if (Trademark.ViewValue == "BMW") && (qty.ViewValue > "1000")
RowAttrs["style"] = "color: red; background-color: #ccffcc";

I have searched the forum and googled for hours. Cannot find the answer. Please help.


motfs
User
Posts: 258

Post by motfs »

You need to convert the string value to number or integer in order to use ">", such as ew_ConvertToInt().


ashworth81
User
Posts: 11

Post by ashworth81 »

Hi Mofts,

thanks for your reply.

I have managed to get the first part working with:

// Row Inserted event
public void Row_Inserted(OrderedDictionary rsold, OrderedDictionary rsnew) {
//ew_Write("Row Inserted");
if (Convert.ToInt32(rsnew["Total Weight kg"]) > 1200)
SuccessMessage = "Warning: The total weight is over 1200kg ";
}

This works correctly.

I am struggling to add a second argument to the statement. I need as below...

// Row Inserted event
public void Row_Inserted(OrderedDictionary rsold, OrderedDictionary rsnew) {
//ew_Write("Row Inserted");
if (Convert.ToInt32(rsnew["Total Weight kg"]) > 1200) && ((rsnew["Haulier"]) == "2")
SuccessMessage = "Warning: The total weight is over 1200kg ";
}

I receive an error "Invalid expression term '&&'"

Any idea how I can add the second clause?


motfs
User
Posts: 258

Post by motfs »

if (Convert.ToInt32(rsnew["Total Weight kg"]) > 1200) && ((rsnew["Haulier"]) == "2")

You miss "(" ")". The correct code is:
if (condition1 && condition2)
...


Post Reply