While writing the asp.net code it is showing error -
i trying program upload document in 1 page , want navigate page document name. wrote code
<%@ page title="home page" language="vb" %> <html> <head> <style type="text/css"> .style1 { width: 100%; } .style3 { width: 185px; } .style4 { width: 129px; } </style> <script language="javascript"> function doc_save() { document.forms[0].submit; action = "mynew_page.aspx"; } doc_save(); </script> <script language ="vbscript " runat ="server" > public sub page_load(byval sender system.object, byval e system.eventargs) handles mybase.load call save_click() end sub public sub save_click() response.write("saving...") end sub </script> </head> <body> <form id="form1" runat="server"> <table class="style1"> <tr> <td class="style4"> <asp:button id="back" runat="server" text="back" /> </td> <td class="style3"> <asp:button id="save" runat="server" text="save" onclick="doc_save()" /> </td> </tr> <tr> <td class="style4"> <asp:label id="label1" runat="server" text="file name"></asp:label> </td> <td class="style3"> <asp:textbox id="textbox1" runat="server"></asp:textbox> </td> </tr> <tr> <td class="style4"> <asp:label id="label2" runat="server" text="description"></asp:label> </td> <td class="style3"> <textarea id="txtarea" name="txtarea" runat ="server" ></textarea></td> </tr> <tr> <td class="style4"> <asp:label id="label3" runat="server" text="file upload"></asp:label> </td> <td class="style3"> <asp:fileupload id="fileupload1" runat="server" width="330px" /> </td> </tr> </table> </form> </body> </html>
when run program showing error below. of course code not yet complete, can u please finish one.
the reason error putting "onclick" attribute on server side element (the asp:button). in context onclick refers server side action taken when button clicked. because function have named doesn't exist in server code fails.
given have javascript function assume want call. in case should use onclientclick attribute. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.onclientclick.aspx has information on , reading around should give better understanding of subject.
Comments
Post a Comment