protected void btn_Click(object sender, EventArgs e) { String name = TextBox1.Text; String desc = TextBox2.Text; //CODE STOPS HERE, DOES NOT EXECUTE PASS THIS POINT String dir = Server.MapPath("files/News/" + FileUpload1.PostedFile.FileName); FileUpload1.PostedFile.SaveAs(dir); String SQL = String.Format(" INSERT INTO SF_news " + " (newsHeader, newsDescription, newsSrc, newsDate, newsYear) " + " VALUES " + " ('{0}', '{1}', '{2}', '{3}')", name, desc, FileUpload1.PostedFile.FileName); new DBHelper().runSQL(SQL); }
<asp:ScriptManager ID="ScriptManager2" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <table> <tr id="hiddenForm" style="visibility:hidden;"> <td colspan="4"> <div> <span>News Header: </span><span><asp:TextBox ID="TextBox1"runat="server"> </asp:TextBox></span> <span>News Description: </span><span><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox></span> <span>News File: </span><span> <dx:ASPxUploadControl ID="FileUpload1" runat="server" UploadMod="auto" Width="280px"></dx:ASPxUploadControl></span> <div> <asp:Button ID="btn" runat="server" Text="Button" OnClick="btn_Click" /> <input type="button" id="jsBtn" /> </div> </div> </td> </tr> </table> </ContentTemplate> </asp:UpdatePanel>
DBHelper
<Triggers> <asp:PostBackTrigger ControlID="btn" /> </Triggers>
UpdatePanel
ashx
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)