Creating a simple Alert / Success Message with ASP.NET/VB using Bootstrap
In your AddContact.aspx page use something like the following
<div class="row-fluid">
<div class="span6">
<h2>New Contact</h2>
</div>
<div class="span6">
<asp:Label ID="AlertWindow" Visible="false" CssClass="alert alert-success" runat="server"></asp:Label>
</div>
</div>
And in your AddContact.aspx.vb code use something similar to this. Basically set the message for the alert window, make the alert window visible and set the approprate css style. You can make this alot cleaner with a set of classes to implement bootstrap for ASP.NET. So this is just an example.
......
......
AlertWindow.Visible = True
Try
......
sSQLQuery = "INSERT INTO......"
......
AlertWindow.Text = "New Contact Added Successfully"
AlertWindow.CssClass = "alert alert-success"
......
Catch ex As Exception
......
AlertWindow.Text = "ERROR: Record not created." & ex.Message.ToString
AlertWindow.CssClass = "alert alert-error"
......
End Try
......
<div class="row-fluid">
<div class="span6">
<h2>New Contact</h2>
</div>
<div class="span6">
<asp:Label ID="AlertWindow" Visible="false" CssClass="alert alert-success" runat="server"></asp:Label>
</div>
</div>
And in your AddContact.aspx.vb code use something similar to this. Basically set the message for the alert window, make the alert window visible and set the approprate css style. You can make this alot cleaner with a set of classes to implement bootstrap for ASP.NET. So this is just an example.
......
......
AlertWindow.Visible = True
Try
......
sSQLQuery = "INSERT INTO......"
......
AlertWindow.Text = "New Contact Added Successfully"
AlertWindow.CssClass = "alert alert-success"
......
Catch ex As Exception
......
AlertWindow.Text = "ERROR: Record not created." & ex.Message.ToString
AlertWindow.CssClass = "alert alert-error"
......
End Try
......
nice post....
ReplyDeleteI admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.
ReplyDeleteHTML5 courses in chennai