Dear members
i want to use a message box in web application with message box icon and message box buttons like ok cancel etc.
Thanks
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Nov 10, 2010, 9:09 PM EST
Better to use Javascript. and Add the onclientclick property to your server control. In the javascript function use confirm("");
If you find my post helpful, Mark it as Answered or Rate the post.
Soft CornerRank #1,221 · 1.5K reputationPosted Nov 10, 2010, 7:06 PM EST
U need to add reference for message box. Add reference in solution explorer System.windows.forms.
then declare " using System.windows.forms" in ur program, u will get Messagebox.show() method.
let me knw if u want anything.
Shailendra Verma47 reputationPosted Nov 10, 2010, 7:26 PM EST
Thanks
Madhu KRank #1,514 · 1.1K reputationPosted Nov 10, 2010, 8:01 PM EST
Manikavelu VelayuthamRank #413 · 6K reputationPosted Nov 10, 2010, 9:14 PM EST
There were lots of option to customize the message box.
You can have your own buttons in that message box, you can place the icons there, it will be like a modal dialog box.
You can also go for a modal as well as modelless dialog box.
Shailendra Verma47 reputationPosted Nov 12, 2010, 10:11 PM EST
I have used like this
string message = "
alert( ' The weightage points are saved successfully in database ' );
";
if (!Page.IsStartupScriptRegistered("clientScript"))
{
Page.RegisterStartupScript("clientScript", message);
}
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Nov 12, 2010, 10:28 PM EST
This is the code for when click on link button:
LinkButton lnkDelete = default(LinkButton);
lnkDelete = (LinkButton)e.Row.FindControl("lnkDelete");
lnkDelete.Attributes.Add("onclick", "javascript:return confirm('Are you sure you want to delete this entry?')");
modify this to ur requirement:
---------------------------------------------------------------------------------
If you find my post helpful, Mark it as Answered or Rate the post.
Suthish NairRank #92 · 22.8K reputationPosted Nov 13, 2010, 6:56 AM EST
you can use jquery article or calling below code in every page
Private Sub CallAlert(ByRef sPage As Page, ByVal syourMsg As String) Dim sString As String = "alert('" + syourMsg + "');" sPage.ClientScript.RegisterStartupScript(sPage.GetType(), "c#corner", sString) sMessage = "" End Sub