Onclick not firing

I have a set of buttons on my master page (I have attached the code below) but no onclick event is being raised. I pulled the final page source and no onclick event was present.

What am I not doing?
--Master
<asp:Button ID="btnSubmit" CssClass="btn" runat="server" OnClick ="Button_Click" />
<asp:Button ID="btnSave" CssClass="btn" CommandArgument="1" CommandName="ButtonPress" runat="server" OnClick="Button_Click" />
<asp:Button ID="btnClear" CssClass="btn" CommandArgument="8" CommandName="ButtonPress" runat="server" OnCommand="Button_Command" />
<asp:Button ID="btnCancel" CssClass="btn" CommandArgument="4" CommandName="ButtonPress" runat="server" OnCommand="Button_Command" />

--Master Code Behind
Protected Sub Button_Command(ByVal sender As Object, ByVal e As CommandEventArgs) Handles btnCancel.Command, btnClear.Command
    Session("ButtonClicked") = e.CommandArgument
End Sub
    
Protected Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click, btnSubmit.Click
    Session("ButtonClicked") = CType(sender, Button).CommandArgument
End Sub

--Page Source
<input type="submit" name="ctl00$btnSubmit" value="Submit" id="ctl00_btnSubmit" class="btn" />
<input type="submit" name="ctl00$btnSave" value="Save" id="ctl00_btnSave" class="btn" />
<input type="submit" name="ctl00$btnClear" value="Clear" id="ctl00_btnClear" class="btn" />
<input type="submit" name="ctl00$btnCancel" value="Cancel" id="ctl00_btnCancel" class="btn" />

Open in new window

rufassaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

StealthyDevCommented:
Do you want a Client side script or a server side script call?

If you want a client side script, just add onclick="function_name()" in the object.
0
princeatapiCommented:
If  you wanna add it for client side use this

eg :

 <script type="text/javascript">
   function foo()
   {
    alert("Sample");
   }
    </script>


.
.
.


<body>
    <form runat="server">
        <asp:Button ID="Test" Text="Click Me" runat="server" />
    </form>
</body>


  protected void Page_Load(object sender, EventArgs e)
    {
        Test.Attributes.Add("onclick", "javascript:return foo();");

    }

things will be okay
0
princeatapiCommented:
you wanna make the server call ??
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

rufassaAuthor Commented:
I want a normal postback, a server call
0
rufassaAuthor Commented:
The problem I am having is that it seems as if I am doing everything right yet not getting the desired results. I am currently doing exactly what is being said in this link.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rufassaAuthor Commented:
I set the PostBackURL property as the last comment suggested and the button started to fire but I got the following error as it fired.
runtimeError.bmp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.