how can you convert string value "txtquantity" in to integer..?? and "price" into float, and "totalPrice" into float.
if these are text boxes then try this..
protected void totalprice()
{
try{
int quantity = int.Parse(txtquantity.Text);
float price =float.Parse(price.Text);
float totalprice = quantity * price;
}
catch(Exception e){
}
if these are string variables then, try this..
protected void totalprice()
{
try
{
int quantity = int.Parse(txtquantity);
float price =float.Parse(price);
float totalprice = quantity * price;
} catch(Exception e) {
}