Subscribe to Subscribers
Talk to Webmaster Tony John


Forums » .NET » ASP.NET »

Probleme aboutx menuitems and buttons in messagebo


Posted Date: 09 May 2012      Posted By:: hayat     Member Level: Bronze    Member Rank: 1634     Points: 5   Responses: 4



Hi,

i have some questions and i hope receive answers :
1) how can i have button that gives me right to choose yes /OR/ no in this example :



private void MessageBox(string message)
{
if (!string.IsNullOrEmpty(message))
{
Response.Write("<script type=\"text/javascript\" language=\"javascript\">");
Response.Write("alert('" + message + "');");
Response.Write("</script>");
}
}




2) i want to make my menuitems align = left in the (au niveau haut de la page d'une maniére horizontale ) in asp.net c#


Thank you so much

Hayat








Responses

#669731    Author: Asheej T K        Member Level: Diamond      Member Rank: 2     Date: 09/May/2012   Rating: 2 out of 52 out of 5     Points: 2

Hi Hayat,

If you are using JavaScript you cannot change the default buttons displayed. In such cases you may use jQuery or other customised methods like opening a pop up or something similar.


Regards,
Asheej T K
Microsoft MVP[ASP.NET/IIS]
DotNetSpider MVM

Dotnet Galaxy



 
#669737    Author: sudhajosyula      Member Level: Gold      Member Rank: 46     Date: 09/May/2012   Rating: 2 out of 52 out of 5     Points: 4

If you are talking about ok cancel,you can use confirmbox the following is the code for it to be written

<html>
<head>
<script type="text/javascript">
function MessageBox()
{
var msg = confirm("Are u sure you want to leave the current page?")
if (msg)
{
alert("you have leaving the page:");
window.location = "http:/localhost:9890/Hello/default.aspx";
}
else
alert("You are in the current page")
}

</script>
</head>
<body>
<form>
<asp:button ID="btnClick" runat="server" onClientClick="MessageBox();" Text="Click Me"></asp:Button>
</form>
</body>



 
#669738    Author: hayat      Member Level: Bronze      Member Rank: 1634     Date: 09/May/2012   Rating: 2 out of 52 out of 5     Points: 1

yes exactly thank you so much :)





 
#670930    Author: Pawan Awasthi Online     Member Level: Diamond      Member Rank: 4     Date: 16/May/2012   Rating: 2 out of 52 out of 5     Points: 2

Hai Hayat,
Instead of using the JavaScript Alert function, you can use the Confirm which will ask the user to first confirm and then based on the user click, it will prompt to the user for selection of Yes or No to confirm the current operation. So the user will have the choice based on the decision.

function ShowConfirmBox()
{
var b = confirm(message)
if (b)
{
window.close();
}
else
{
// navigate to another window
}
}

Hope it will be helpful to you.

Regards,
Pawan Awasthi(DNS MVM)
+91 8143683708 (pawansoftit@gmail.com)
Outstanding Contribution Award..NTT Data Inc



 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Scrolling selected row in GridView
Previous : How to freeze the gridview header coloumn in asp.net
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.