Click here to Skip to main content
11,709,955 members (85,185 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
Hello sir,
I know to create alert box in server side.
public void Messagebox(string message)
{
        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + message + "');", true);
}
but how to create message box with ok cancel or yes no options in web application
in server side?

How to create serverside message box with yes or no options in web application?
Posted 23-Jan-13 20:23pm
Edited 23-Feb-13 3:12am
ProgramFOX164.7K
v2
Comments
Sergey Alexandrovich Kryukov at 24-Jan-13 2:36am
   
Do you really know what is HTTP and Web? How server-side? Who will look at this message box? A personal on duty in the server factory? Poor guy may decide to quite drinking if he sees it... :-)
—SA
sugunakumaravel at 24-Jan-13 3:26am
   
Hello Sir, I want to show the message box in client side only.in server side one button click want to check one particular condition after that i want to give message box with yes or no options to the client.Please understand my question clearly and asnwer
shabari7 at 24-Jan-13 23:52pm
   
better use confirm and if proceed based on ok/cancel, in the client script, reload th e page to trigger the page load event,do the stuff there.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

First write this code in your .ASPX.

<div id="divMessage" runat="server" class="" style="display: none;">
       <asp:Literal runat="server" ID="ltlMessage" Text="test"></asp:Literal>
   </div>


Then just write this code behind you .CS page.

public static void ShowMessage(string _class, string msg, System.Web.UI.HtmlControls.HtmlGenericControl divMessage, Literal ltlMessage)
       {
           divMessage.Style.Add("display", "block");
           divMessage.Attributes.Add("class", _class);
           ltlMessage.Text = msg;
       }


try
               {
                   UISettings.ShowMessage("alert alert-success", "Insert Successfully", divMessage, ltlMessage);
               }
               catch (Exception ex)
               {
                   ShowMessage("alert alert-error", ex.InnerException.Message, divMessage, ltlMessage);
               }
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 549
1 OriginalGriff 255
2 Peter Leow 174
3 Abhinav S 110
4 Suvendu Shekhar Giri 90
0 Abhinav S 60
1 Member 4653839 40
2 barneyman 35
3 Sergey Alexandrovich Kryukov 35
4 Member 11793820 35


Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 23 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100