Hey guys Im trying to make an auction website for school using html, ASP and a database in Acess.
I am trying to create buttins so my users can click on them to Bid on people.
I keep coming up with different errors and when I view the source code after running the page it's different than the code I entered in dreamweaver on my page.

<input value="Bid Now!" type="submit" onClick="msgbox('hello')">

This is the code for the button on one page.

<html>
<body>

<form runat="server">
<asp:Button id="b1" Text="Submit" runat="server" />
</form>

</body>
</html>

This is another test example which isn't being interpreted properly.
Can anyone please help?

Dani AI

Generated

As and noted, ASP.NET server controls are converted into standard HTML before the browser sees them. That is why the page source shown by the browser differs from the design-time markup. The browser's developer tools (F12) are the right place to inspect the rendered DOM, see attached event handlers, and get the exact script error location.

The posted runtime error ("Object Expected") means the browser tried to call something that doesn't exist. In the snippet shown earlier the call to msgbox('hello') triggers that because msgbox is not a built-in JavaScript function (it comes from VBScript/MSHTA contexts). Two straightforward fixes are to use the built-in alert() or to define a small wrapper function named msgbox. Also be careful with ASP.NET properties: server-side OnClick wires a server event, while client-side script belongs in OnClientClick or an onclick attribute added at render time.

Example client-side patterns:

<asp:Button ID="btnBid" runat="server" Text="Bid Now"
    OnClientClick="msgbox('hello'); return false;" />
<script type="text/javascript">
function msgbox(text) { alert(text); }
</script>

Common troubleshooting checklist: open the F12 console to get the exact file/line and stack, verify any external .js files loaded (Network tab), ensure script definitions appear before they are called (or use DOMContentLoaded/window.onload), and if using UpdatePanel register client scripts with ScriptManager so they persist after partial postbacks. To stop a postback after a client action, return false from the client handler.

The generated HTML and the browser console output are the most useful diagnostic artifacts for pinning this down.

Recommended Answers

All 5 Replies

Hi

Can you post errors u r receiving... and be clear n specific about your problem..

Hope we i can help you.

I keep coming up with different errors and when I view the source code after running the page it's different than the code I entered in dreamweaver on my page.

<input value="Bid Now!" type="submit" onClick="msgbox('hello')">

Of course you will get different control when you view the source code of the page because the Explorers(IE,FireFox...) does not know what is <asp:Button...> so the compiler (VS,Dreamwaver) change them to a control that the explorers will know them, in a case of a button its <input>, so you dont have a problem its working just fine.

Now what errors do you get?, be more specific and tell us exactly what you do and which error do you get.

ASP.NET Controls are classes in the .NET Framework that represent visual elements on a web form. During web-form processing phases - all server controls (asp.net controls) writes the HTML output for the control based on its current state.

ok the error for (<input value="Bid Now!" type="submit" onClick="msgbox('hello')">) button is:

Line:33
char:1
Error: Object Expected
Code:0

Sorry I cant give you the proper one for the other buttons as my teacher played around with my pages and kinda killed them. I'll post as soon as I get them up and running again :(

Post your code please.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.