473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

why a commandbutton give error

'Investor.cmdSaveEduCost' is a 'field' but is used like a 'method'

the HTML code is...
<asp:Button ID="cmdSaveEduCost" runat="server" Text="Save" OnClick = "cmdSaveEduCost" />

and the C# code is as folow...
protected void cmdSaveEduCost_Click(object sender, EventArgs e)
{
string connectionString = ConfigurationManager.ConnectionStrings["sqlFWA"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
SqlCommand command = new SqlCommand();

//command.Parameters.AddWithValue("@Investor_ID", Session["sInvestor_ID"]);
command.Parameters.AddWithValue("@ItemDescription" , ItemDescription.Text);
command.Parameters.Add("@AnnualCost", SqlDbType.Money).Value = AnnualCost.Text;
command.Parameters.AddWithValue("@CPIChildCost", CPIChildCost.Text);
command.Parameters.AddWithValue("@ChildCostItemTot al", ChildCostItemTotal.Text);

command.CommandType = CommandType.StoredProcedure;
command.CommandText =("[dbo].[NavinInsertCommand]");
command.Connection = conn;
conn.Open();
command.ExecuteNonQuery();

grdEduChild.DataBind();
conn.Close();
ItemDescription.Text = "";
AnnualCost.Text = "";
CPIChildCost.Text = "";
ChildCostItemTotal.Text = "";
}
Apr 12 '07 #1
1 889
Plater
7,872 Expert 4TB
You appear to have a slip up.
THIS:
<asp:Button ID="cmdSaveEduCost" runat="server" Text="Save" OnClick = "cmdSaveEduCost" />

SHOULD BE:
<asp:Button ID="cmdSaveEduCost" runat="server" Text="Save" OnClick = "cmdSaveEduCost_Click" />
Apr 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Bernd Smits | last post by:
Hi, I would like to delete a record (with commandbutton) of a table associated to a combobox, when I select a certain value in the combobox (the value I select is associated with the record that I...
6
by: Sakharam Phapale | last post by:
Hi All, How to move the CommandButton control using mouse from one position to other? Is it possible using Drag, Drop events or I have to write my own code for that? I have set the...
0
by: kar3n.chandra | last post by:
Hey, i have a c# program opening and creating powerpoint slides and i created a commandbutton on the slide. the problem i'm having is changing the caption of the button. i've placed the code...
4
by: Jamey Shuemaker | last post by:
Howdy, Saw a couple threads from the past few years on this topic, but didn't really find any solutions. Here's one I found:...
1
by: HelloWorldHelloWorldHello | last post by:
Can Anyone Tell Me How to direct KeyAscii with using CommandButton Only.?
2
by: gsuns82 | last post by:
Hi all, I am working a page that consists two <h:commandButtons> n two <h:inputText> fields,if i hit enter key the first button is invoked by default even when i am in second text...
2
by: kaokao1 | last post by:
(Please Excuse my poor English). Hello Friend, Receive a cordial greeting. Friend, please see if you could help me with the following thing: I opened a Sheet of Excel, then I inserted a...
9
by: leon Galushko | last post by:
Hi, I want to set a CommandButton (Click - Event) to let the programm code (below) progress. The question is how is that exactly to do on the point. The as boolean declared variable...
2
by: Slick50 | last post by:
I am about ready to finally give up on CSS and fall back to tables. Positioning is becoming too frustrating for the novice with CSS alone... I have a simple form. Conceptually I divide up each...
0
by: susan | last post by:
Hi, I'm using Accrss 2003. I try to build a GUI using the Webpage-option in Access. Now I want to call a procedure by placing a CommandButton on the webpage. Doing so I find the following in thr...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.