Click here to Skip to main content
15,892,298 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: custom asp.net sql server shopping cart problem. Pin
VijayVishwakarma3-Sep-08 23:57
VijayVishwakarma3-Sep-08 23:57 
GeneralRe: custom asp.net sql server shopping cart problem. Pin
eyeseetee4-Sep-08 0:17
eyeseetee4-Sep-08 0:17 
GeneralRe: custom asp.net sql server shopping cart problem. Pin
VijayVishwakarma4-Sep-08 0:31
VijayVishwakarma4-Sep-08 0:31 
QuestionSetting up an enviroment for sharpoint 2007 Pin
TheEagle3-Sep-08 21:36
TheEagle3-Sep-08 21:36 
QuestionHandling Browser Close button Pin
K V Sekhar3-Sep-08 21:30
K V Sekhar3-Sep-08 21:30 
AnswerRe: Handling Browser Close button Pin
Abhijit Jana3-Sep-08 22:43
professionalAbhijit Jana3-Sep-08 22:43 
GeneralRe: Handling Browser Close button Pin
K V Sekhar3-Sep-08 23:03
K V Sekhar3-Sep-08 23:03 
GeneralRe: Handling Browser Close button Pin
K V Sekhar4-Sep-08 0:07
K V Sekhar4-Sep-08 0:07 
I tried ur logic. Its not working properly.

If any where i went wrong, let me know.

Here is my code
MastrPage:
==========
Default.master(Design)
<%@ Master Language="C#" CodeFile="Default.master.cs" Inherits="Default_master" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script type= "text/javascript">
function UpdateDataBase()
{
// Check Browser Close [X] , Alt+F4 , File -> Close
if (window.event.clientX < 0 && window.event.clientY < 0)
{
window.open("DummyPage.aspx?test=test", "OpenWindow_Close_Session", 'left=12000,top=1200,width=10,height=1');
}
}

</script>


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head runat="server">
<title></title>
</head>
<body>

<form id="form1" runat="server">

<div class="header">
<h1 style="color: #FFFFFF">Prospecta technologies</h1>
<h2 style="color: #FFFFFF">Proxy Ads Management System</h2>
<div class="nav">
<asp:Label ID="lbl_Welcome" runat="server" Visible="False" Font-Bold="True"
ForeColor="White"></asp:Label>
| &nbsp;
<asp:SiteMapPath id="SiteMapPath1" runat="Server" PathSeparator=" > " RenderCurrentNodeAsLink="true" />
&nbsp; | &nbsp;
<asp:LinkButton ID="hlink_Logout" runat="server"
onclick="hlink_Logout_Click" CausesValidation="False"
ValidationGroup="Click here for Logout" Visible="False">Logout</asp:LinkButton>
</div>
<asp:Menu id="menua" runat="server"
cssclass="menua"
orientation="Horizontal"
maximumdynamicdisplaylevels="0"
skiplinktext=""
staticdisplaylevels="2" >
<Items>
<asp:MenuItem NavigateUrl="~/LoginPage.aspx" Text="Login" Value="Login"
ToolTip="Login">
</asp:MenuItem>

<asp:MenuItem Text="About Us" ToolTip="About Us" Value=" About Us"
NavigateUrl="~/AboutUs.aspx">
</asp:MenuItem>
<asp:MenuItem NavigateUrl="~/ContactUs.aspx" Text="Contact Us"
Value="Contact Us" ToolTip="Contact Us"></asp:MenuItem>
</Items>
</asp:Menu>


</div>

<asp:contentplaceholder id="Main" runat="server" onunload="Main_Unload" />
<div class="footerbg">
<div class="footer">
<asp:Menu id="menub" runat="server"
cssclass="menub"
orientation="Horizontal"
maximumdynamicdisplaylevels="0"
skiplinktext=""
staticdisplaylevels="2" Height="16px" Width="290px" >
<Items>
<asp:MenuItem NavigateUrl="~/LoginPage.aspx" Text="Login" ToolTip="Home"
Value="Home"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/AboutUs.aspx" Text="About Us" ToolTip="About Us"
Value="About Us"></asp:MenuItem>
<asp:MenuItem NavigateUrl="~/ContactUs.aspx" Text="Contact Us"
ToolTip="Contact Us" Value="Contact Us"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
</form>

</body>
</html>

My CodeBlock
Default.master.cs:(The below method is not executing when i closes the browser. I tried by placing break point)
==================
protected void Main_Unload(object sender, EventArgs e)
{
string str = "<script language=javascript>";
str += "javascript:UpdateDataBase();";
str += "</script>";

Page.RegisterStartupScript("test", str);

//string script;
//script = @"<SCRIPT language='javascript'> + "function name</SCRIPT>";
//this.RegisterStartupScript("MyAlert", script);
}
//////////////////////////////
DummyPage.aspx.cs(This is the page i am redirecting to user from javasript method)

PageLoad()
{
if(!Page.IsPostBack)
{
if(Request.QueryString["msg"]!="") // I am trying to create a direcory for Checking purpose
{
DirecoryInfo dir = new DirecoryInfo(@"D:\Test");
if(dir.Exists == false)
dir.Create();
}
}
}

..................

Please suggest me where i went wrong.

Thnks in advance.
AnswerRe: Handling Browser Close button Pin
eyeseetee3-Sep-08 22:57
eyeseetee3-Sep-08 22:57 
Questiongridview rowupdating using parametrized query. Pin
wajans3-Sep-08 21:20
wajans3-Sep-08 21:20 
QuestionGrid view issue while editing Pin
trilokharry3-Sep-08 20:27
trilokharry3-Sep-08 20:27 
QuestionEmail domain verification code not working Pin
Learning IT3-Sep-08 20:23
Learning IT3-Sep-08 20:23 
AnswerRe: Email domain verification code not working Pin
Guffa3-Sep-08 20:45
Guffa3-Sep-08 20:45 
GeneralRe: Email domain verification code not working Pin
Learning IT3-Sep-08 21:31
Learning IT3-Sep-08 21:31 
QuestionAdding the Datatable values to GridView in .net 2005 Pin
Karan_TN3-Sep-08 20:19
Karan_TN3-Sep-08 20:19 
Questiondisplay Records details inside formview on linkbutton click (problem) Pin
Rameez Raja3-Sep-08 20:01
Rameez Raja3-Sep-08 20:01 
QuestionDownload three datagrid in one excel file Pin
Tarun Dudhatra3-Sep-08 19:19
Tarun Dudhatra3-Sep-08 19:19 
QuestionUsing Aspnet_regsql.exe Pin
ASPnoob3-Sep-08 17:26
ASPnoob3-Sep-08 17:26 
Question3.5 sp1 and vs 2008 sp1 Pin
ToddHileHoffer3-Sep-08 6:06
ToddHileHoffer3-Sep-08 6:06 
AnswerRe: 3.5 sp1 and vs 2008 sp1 Pin
ToddHileHoffer3-Sep-08 8:23
ToddHileHoffer3-Sep-08 8:23 
GeneralRe: 3.5 sp1 and vs 2008 sp1 Pin
N a v a n e e t h3-Sep-08 17:21
N a v a n e e t h3-Sep-08 17:21 
QuestionHTML CONTROL Pin
kibromg3-Sep-08 4:40
kibromg3-Sep-08 4:40 
AnswerRe: HTML CONTROL Pin
NeverHeardOfMe3-Sep-08 4:50
NeverHeardOfMe3-Sep-08 4:50 
AnswerRe: HTML CONTROL Pin
Pete O'Hanlon3-Sep-08 4:51
mvePete O'Hanlon3-Sep-08 4:51 
GeneralRe: HTML CONTROL Pin
kibromg3-Sep-08 5:07
kibromg3-Sep-08 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.