HTML Markup
The following HTML Markup consists of a standard form with some fields and a Button to submit the form and insert the data into database.
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td> Name: </td>
- <td>
- <asp:TextBox ID="txtName" runat="server" /> </td>
- </tr>
- <tr>
- <td> City: </td>
- <td>
- <asp:TextBox ID="txtCity" runat="server" /> </td>
- </tr>
- <tr>
- <td> Country: </td>
- <td>
- <asp:TextBox ID="txtCountry" runat="server" /> </td>
- </tr>
- <tr>
- <td> </td>
- <td>
- <asp:Button ID="btnSave" Text="Save" runat="server" OnClick="Save" /> </td>
- </tr>
- </table>
C#
- protected void Save(object sender, EventArgs e)
- {
-
-
- string message = "Your details have been saved successfully.";
- string script = "window.onload = function(){ alert('";
- script += message;
- script += "')};";
- ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
- }