Hi sani.ss501,
Refer below sample.
HTML
<script type="text/javascript" src='https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js'></script>
<script type="text/javascript" src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js'></script>
<link rel="stylesheet" href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css'
media="screen" />
<script type="text/javascript">
function ShowPopup(title, body) {
$("#MyPopup .modal-title").html(title);
$("#MyPopup .modal-body").html(body);
$("#MyPopup").modal("show");
}
</script>
<center>
<asp:Button ID="btnShowPopup" runat="server" Text="Show Popup" OnClick="Show" CssClass="btn btn-info btn-lg" />
<asp:Button ID="Button1" runat="server" Text="Display Popup" OnClick="Display" CssClass="btn btn-info btn-lg" />
</center>
<!-- Bootstrap -->
<!-- Bootstrap -->
<!-- Modal Popup -->
<div id="MyPopup" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
×</button>
<h4 class="modal-title">
</h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
Code
C#
protected void Show(object sender, EventArgs e)
{
showPopup("Greetings", "Welcome to ASPSnippets.com");
}
private void showPopup(string title, string body)
{
ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + title + "', '" + body + "');", true);
}
protected void Display(object sender, EventArgs e)
{
showPopup("Hey", "Guys !");
}
VB.Net
Protected Sub Show(ByVal sender As Object, ByVal e As EventArgs)
showPopup("Greetings", "Welcome to ASPSnippets.com")
End Sub
Private Sub showPopup(ByVal title As String, ByVal body As String)
ClientScript.RegisterStartupScript(Me.GetType(), "Popup", "ShowPopup('" & title & "', '" & body & "');", True)
End Sub
Protected Sub Display(ByVal sender As Object, ByVal e As EventArgs)
showPopup("Hey", "Guys !")
End Sub
Screenshot