this first asp.net web app , every form without <form runat="server"></form>
tag not running plus element should inside form tag. have buttons links other pages of project.
if use following code opens new link on page instead of same page:
<asp:button id="buttonattendance" onclientclick="window.open('attendanceform.aspx','attendanceform')" runat="server" text="attendance" cssclass="btn" /><br />
and if use following code every buttons acts after filling form elements only:
<asp:button id="buttonattendance" onclick=buttonattendance_click() runat="server" text="attendance" cssclass="btn" /><br />
code behind:
protected void buttonattendance_click(object sender, eventargs e) { response.redirect("attendanceform.aspx"); }
my requirement when click on button should redirect related page directly on same page without filling form elements. how possible?
your code behind looks fine.
if using webform have put controls within form tags postback work correctly , raise onclick
event on sever side.
<form runat ="server"> <asp:button id="buttonattendance" onclick=buttonattendance_click() runat="server" text="attendance" cssclass="btn" /><br /> </form>
if don't need have server set values or interact buttons on page make them regular html buttons , use onclick event javascript redirection.
<button id="btnattendance" onclick="window.location.href='attendanceform.aspx';return false;" class="btn">attendance</button>
Comments
Post a Comment