## 3 replies

Last post Jul 19, 2018 06:26 AM by Abraham Qian

• mike4u

Contributor

2564 Points

1919 Posts

### how to multiply in eval

``` <td width="50px" class="cost">
<%# Eval("cell_08")*(12)*Eval("cell_07")%>
</td>           ```

i have to multiply. kindly suggest

• rajesh93180

Participant

1634 Points

792 Posts

### Re: how to multiply in eval

```<td width="50px" class="cost">
<%# Convert.ToInt32(Eval("cell_08"))*(12)*Convert.ToInt32(Eval("cell_07"))%>
</td>     ```

Try this code.

• vahid bakkhi

Star

8089 Points

2779 Posts

### Re: how to multiply in eval

Jul 18, 2018 11:57 AM|vahid bakkhi|LINK

hi

as rajesh93180 said for multiplication of two numbers, you have to convert it to an int or decimal or ... and then show it a string format if you want

```        <td width="50px" class="cost">
<%# String.Format("{0}",Convert.ToInt32(Eval("cell_08")) * 12 * Convert.ToInt32(Eval("cell_07"))) %>
</td> ```

vahid bakhtiary

• Abraham Qian

Member

670 Points

292 Posts

### Re: how to multiply in eval

Jul 19, 2018 06:26 AM|Abraham Qian|LINK

Hi Mike4u,

From your description, I suggest you could refer to the above example.

`<%# Convert.ToInt32(Eval("cell_08"))*Convert.ToInt32(Eval("cell_07")) %>`

Because the Eval function return object, we need to convert it to a number before we can operate.

We could also use another way.

Aspx.

`<%# Handle(Eval("cell_08"),Eval("cell_07")) %>`

Code behind.

```//Tostring method is executed by default
protected int Handle(object o1,object o2)
{
return Convert.ToInt32(o1) * Convert.ToInt32(o2);
}```

Feel free to let me know if you have any questions.

Best Regards

Abraham