my requirement--- when i click button message box should be displayed in web form
Message Box
How to create a Message box in a.s.p.net?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Keyur PatelPosted Jul 31, 2013, 3:15 AM
I think, i am bit late in this thread. I would suggest first to user Javascript alert function to use in your web form to display your alert as suggested by users in this forum.
If you do not want to use Javascript Alert function then you can use external Win32 dll Methods and invoke Message Box method same as we are using in Window form but i would not suggest to use this option.
Please find the attached sample to display MessageBox same like in window form.
Mark as Accepted if it helps you.
Iftikar HussainPosted Jul 30, 2013, 12:00 AM
Try like this
if you don't want to submit the page after clicking the button return false otherwise removed this line.
Regards,
Iftikar
Iftikar HussainPosted Jul 30, 2013, 12:00 AM
Try like this
if you don't want to submit the page after clicking the button return false otherwise removed this line.
Regards,
Iftikar
Iftikar HussainPosted Jul 30, 2013, 12:00 AM
Try like this
if you don't want to submit the page after clicking the button return false otherwise removed this line.
Regards,
Iftikar
Akhil MittalPosted Jul 29, 2013, 11:56 PM
///
/// A JavaScript alert///
public static class Alert
{///
/// Shows a client-side JavaScript alert in the browser.///
/// The message to appear in the alert.
public static void Show(string message)
{// Cleans the message to allow single quotation marks
string cleanMessage = message.Replace("'", "\\'");string script = string.Format("", cleanMessage);
// Gets the executing web page
Page page = HttpContext.Current.CurrentHandler as Page;
// Checks if the handler is a Page and that the script isn't all ready on the Page
if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alert"))
{
page.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", script);
}
}
}
http://www.c-sharpcorner.com/Blogs/12168/javascript-alert-in-C-Sharp.aspx
Mark as Accepted if it helps u.
Sanjeeb LenkaPosted Jul 29, 2013, 1:25 PM
you can try following code. it will show a message on button click
ex:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>
if any doubt or problem reply