Hello All,
I am trying to perform a simple calculation while in the edit or insert twmplate in a FormView. I am using Visual Studio 2005 and C#. I asked this in the C# forum but not much help. Here is what I have now:
protected void Button1_Click1(object sender, EventArgs e)
{
//declare variables
decimal subtotal10:
decimal hour1010;
decimal hour1011;
decimal hour1020;
//get information from form
hour1010 = ((TextBox)FormView1.FindControl("Hours1010TextBox"));
hour1011 = ((TextBox)FormView1.FindControl("Hours1011TextBox"));
hour1020 = ((TextBox)FormView1.FindControl("Hours1020TextBox"));
//calculate hours
subtotal10 = hour1010 + hour1011 + hour1020 *1;
//display hours
TextBox a = (TextBox)FormView1.FindControl("SubHours10TextBox");
a.Text = subtotal10;
FormView1.FindControl("TotalHoursTextBox").Focus();
}
The user inputs number of hours in then clicks a calc button. I am getting errors in several different areas as I change it. Like Can not convert string to int or int to string. Most of the errors happen in 2 areas the get information area or the display area.
Any Suggestions I am beginning to think that this can not be done in FormView.
Thanks for your help.
gene