.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Access to Top right Close Button

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :WPF

I have an WPF application built using VS 2008 .net in VB code with 3.5 framework. I have a number of xaml pages that i have an added button on the page and menubar item that closes the page. When i open and close the page i set a global variable to indicate if the page is open or closed. So....if i use the added button to close the page the variable is set to closed. However, if i open a page and use the red close button at the top right of the window, the page closes but the global variable does not get set. Therefore when i try and open that page again, i get a message the page is already open.

So, my question is how do i access the code and set a variable if the red X window close button is used? Also Windows 7 allows the same functionality by clicking on the Icon of the open window in the Task Bar and closing it that way.

Any help will be greatly appreciated.


View Complete Post

More Related Resource Links

Access denied when user clicks refresh BDC column button

Access denied occurs with any non Site Collection Administrator regardless of rights.  It only occurs in this site collections, others they are able to refresh.  In this particular collection they can add a BDC column to a list, edit an item and place/resolve a value in the bdc col; but when they refresh they are given an acess denied.  Any thoughts on what they need read access to?  This goes away if I give site admin privs (dont want to do that) or give them read only access on the web application (dont want to do that either).

Authentication Providers button greyed out. Trying to turn on anonymous access

Please can you assist. I am trying to enable anonymous access. Tutorials point me to: 'Central Admin > Site Actions > Site Settings > Application Management > Manage web applications > Sharepoint - 80' I should then click on 'Authentication Providers'. This button is greyed out. I am running in dev on windows 7 64bit. Thanks.

Close Thickbox From Button Click inside of iframe

I know this question has been asked several times, but all fo the answers I found did not work for me.I have a jQuery Thickbox that pops up and display's an iframe.  Within the iframe, there is a button that will sumit the form and then I would like thickbox to close as well.From what I have found, adding the command "parent.document.tb_remove()" to the OnClick tag in the button shoudl work but I keep getting the error:  Compiler Error Message: BC30456: 'document' is not a member of 'System.Web.UI.Control'.Here is the code of the aspx page that opens in the iframe:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="LeagueEmail.aspx.vb" Inherits="LeagueEmail" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <link rel="Stylesheet" type="text/css" href="CSS/mf42_layout1_setup.css" /> <link rel="Stylesheet" type="text/css" href="CSS/mf42_layout1_text.css" /> <link rel="stylesheet" href="CSS/thickbox.css" type="text/css" media="screen" /> <title></tit

hover-ad creator Problem + Close button is not showing in IE



close button is not showing in IE. working fine in FF and others.

Please help SmileSmile

Why Windows Close Button send data to SQL?


Hi all.


I have UI app windows with combo boxes which updating data into SQL Store Procedure.

I open UI windows do some updating data update correctly but is A problem rise when I open window again and  do nothing only close windows by clicking button close("X") on win a application updating sql table as if I click button send...

How to change(handle) title bar's Close button in WPF?


First of all I want to say why I want to do that

I have UI app which display and send(update)data into SQL Store Procedure<!-- [if gte mso 9]>starts I open a window and does nothing but to close it by clicking title bar's Close button still application send data to SQL SP.

If necessary I can add the windows code

thank you for advance.

Disable/Hide/Redirect Close Button


Hi all,

was wondering if there was any way Out of Box to disable/hide/redirect the close button when drilling down on a list item. I see it is possible using code, but this is not an option for us at this time as it is not supported.


Rerouting the Close button from an item

I m implementing our company site using WSS 3.0 and have come across an
issue. On the home page I use a query webpart to access an events list. As it
stands the items are listed on the home page, and once an item is clicked
upon it goes to the item's page which is a dispform.aspx page. When they
press "close" on that page they're brought back to the entire liist. Is there
anyway to reroute the close button?

WPF button with short cut character access no longer possible?


I defined a string like "&OK" is my resource file.

if i do normal WinForm application, with a button that I do button.text = Properties.Resources.OK, my button will appear with a text "OK" with a short cut key underlined O on it.

However, if i do it in WPF, i would set my button with button.Content = Properties.Resources.OK?? then my button in WPF will appear as &OK

How to overcome this problem?

Please help me. THanks


1 + 1 = 3

Hide Modal Dialog Close Button when dialog is already shown


Hey everyone,


Was wondering, how do you hide the close button of a modal dialog, when it's already shown, i.e. the page that's being loaded into the dialog, in there is a web part, and i want to trigger a script call to hide the close button of the current modal container.

I know you could give options to the modal dialog when you shot it to hide the close button, but not sure if you can do it after it has shown. I have no control of adding the option when it's showing the dialog, as this is done by the Add new item link in a list.




Access PreviousPage on the button click handler of target page


Hi, I Have two pages source.aspx and target.aspx. Source.aspx has one button and other form controls the collect input. The button has its postbackurl property set to target.aspx.

On target.aspx I have another button and other form controls that collect input. When the user clicks on the target.aspx button, I want the inputs from both source and target gathered to be inserted into the database. The problem is the Page.PreviousPage property is only available during the initial rendering of the target.aspx page. So when I click on target.aspx button, PreviousPage is now null. 

One strategy of mine is to collect the information on page_load and store it in ViewState, but is there any other method that I should consider in this process. I think the cleanest approach would be to somehow access PreviousPage on the button_click event handler, but how can I access this property.


How can I access a radio button value selected in a dataview?



I have an aspx page that uses a simple form to perform a search and the results are presented in a dataview.

I have added a radio button to one of the columns and have set the value to be the records ID. What I need to do is allow the user to select the row they require from the data view by selecting the radio button.

Does anyone know how I can access the ID value of the selected radio button?

Eventually I will have a number of dataviews on the same page and will need to allow the user to select a row from each dataview and then send the radio button values to another page using query string generated by a button.

How to know whether the close button on browser has been clicked


Hi All,

 I want to perform some session and application related activities on server side, when the close button of browser is clicked.


1. I have handled it using 'OnBeforeUnload' in body tag of master page

2. but it is getting fired for even if the end user navigates to other page.

3. so my requirement is to call the code on server side, only iff, the close button of the browser is clicked.

Thanks in Advance..


Hi guys,

This is still unsolved problem. Because according to mudassarkhan, if i apply his solution, then everything is ok.

but when the page is regreshed, the value of clicked variable becomes false and undesired action happens once again.

Please come with some solution..guys..

how to specify file name and close the info path form on custom submit button?

i have submit button in the form once i click it must ask to enter the file name and once i given it it must close the particular browser tab.

how to specify file name and close the info path form on custom submit button?

i have submit button in the form once i click it must ask to enter the file name and once i given it it must close the particular browser tab.

How to disable the show modaldialog close button



i want to know How to disable the show modaldialog close button in javascript .. if any one know please give the solution.

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend