|
You can do one thing
if(window.event.clientX < 0 && window.event.clientY <0)
{
window.open("CloseSession.aspx", "OpenWindow_Close_Session",'left=12000,top=1200,width=10,height=1');
}
In CloseSession.aspx Page Load Do the server side task and make it self.Close();
protected void Page_Load(object sender, EventArgs e)
{
Session.Abandon();
string strPopupScript = "<script language="javascript">self.close();</script>";
Page.ClientScript.RegisterStartupScript(typeof(Page), "PopUpScript", strPopupScript);
}
Hope this will help you.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
but sir i cannot put this code my above 200 web page
|
|
|
|
|
So you don't have master page ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
you don't have to. Another alternative is create web handler page (ashx page) put the functionality Abhijit provided in the ProcessRequest call it using ajax.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Yup Excelent... That is the best option, if you don't have the master page you can simply do it using handler other wise write the same in master page.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
I am facing a unique problem (looks unique to me at least). I have a dropdown whose auto-postback is enabled. User can select a value from the dropdown to go to another page. But when the user comes back to original page by clicking the back button on the browser and clicks any button then on the post-back caused by the button, first the "SelectedIndexChanged" event handler of that dropdown is called then the "Click" event handler of this button is called. Hope I have explained the problem clearly.
Can anyone tell me what's going wrong and how to solve the issue?
|
|
|
|
|
Just put the code that you have written for redirect to different page of Dropdownlist SelectedIndexChanged.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
I did the same but it is not working......looks like the browser is remembering the previous state of the page and so is causing the previous event to be raised in addition the present event..... I think I have to take help of javascript. Thank for the reply
|
|
|
|
|
om pr wrote: I did the same but it is not working....
But I didn't suggested you to do any thing. I have just asked you to put those selected index change code.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Can you be a bit more elaborate. I did not understand what you want to suggest!
|
|
|
|
|
om pr wrote: Can anyone tell me what's going wrong and how to solve the issue?
I suspect that what is happening is that when you go back the browser remembers the state of the controls when you originally left the page and sets them to those values. However, this time the value change for the drop down does not trigger a post back.
When you press the button the postback is triggered. The server then compares what is in the viewstate with what the controls now look like and raise events for any changes. Because it sees two changes (the drop down and the button click) those events are raised.
A possible route to solving the issue is to turn off the viewstate (which also means you won't get change events, although you will still get button click events) and detect the drop down change yourself rather than rely on ASP.NET.
|
|
|
|
|
Thanks for the reply Colin, I tried all possible options including disabling the viewstate as suggested by you but it all failed. I just managed to solve the issue with the help of javascript. Instead of sending the user to the next page via Response.Redirect on the index change of the dropdown, I am now doing the same with the help of simple javascript i.e. window.location.href. Thanks again for the reply, appreciate it!
|
|
|
|
|
What happens if the user has disabled javascript?
|
|
|
|
|
I our case this will not happen because whole site is javascript dependent. If it is disabled then nothing will work and moreover the site is for Intranet use and user of this site will not have the flexibility to turn the javascript setting of the browser on or off at will.
But this question still remains. What if the site were for general public on the Internet? In that case what could be the solution if even javascript could not solve it? Any idea!!
|
|
|
|
|
Is this happening only one one machine? Can you reproduce it on another machine.
Today, I spent 30 minutes on non-issue with my boss's machine. The browser had old cached copy and clearing the cache *fixed* the issue.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
<%@ Page Language="C#" MasterPageFile="~/Login.master" AutoEventWireup="true"
CodeFile="Login.aspx.cs" Inherits="Login" Title="Login"%>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table background="images\login.jpg" style="width:471px; height:350px; margin-top:60px; margin-left:auto; margin-right:auto; border-width:thick; border-style:solid; border-color:White;" border="3">
<tr><td>
<asp:TextBox class="gradient" id="username" runat="server" />
<input class="gradient" type="text" name="T9" size="20" />
<asp:TextBox class="gradient1" id="password" runat="server" TextMode="Password" />
<p><asp:ImageButton class="loginbutton" imageurl="images/signin.jpg"
ID="submitButton" Style =" left:685px; top:272px; position:absolute"
runat="server" Text="Login"
OnClick="LoginUser" /></p>
</td></tr>
</table>
</asp:Content>
I have written this code on my Login Page.
But on run mode this imagebutton,Textbox position is changing automatically.
What is wrong in my code?
Thanks,
|
|
|
|
|
The problem is with Layout of you application. If you have some times then just go through with GRIDLayout and FromLayout Desing of ASP.NET.
You can use proper CSS to Fix Them.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
.loginbutton
{
border-style: none;
border-color: inherit;
border-width: 0;
height: 23px;
width: 88px;
position: fixed;
padding-top:2px;
top: 204px;
left: 676px;
}
I am using CSS...But same problem...
modified on Tuesday, April 14, 2009 8:33 AM
|
|
|
|
|
Hi all,
How I can convert this code to a WebMethod in WebService?
This code is here:
Protected Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.Click
Dim con As SqlConnection = New SqlConnection(WebConfigurationManager.ConnectionStrings("Articles").ConnectionString)
Dim cmd As SqlCommand = New SqlCommand("SELECT Title, Content FROM tblArticle", con)
con.Open()
Accordion1.DataSource = cmd.ExecuteReader
Accordion1.DataBind()
con.Close()
End Sub
I try to convert this code to webmethod But I couldn't convert it to a WebMethod for WebService and use it in Application.
How I can do this work?
Please help me,
Thank you
Hoda
|
|
|
|
|
Saba02 wrote: I try to convert this code to webmethod But I couldn't convert it to a WebMethod for WebService and use it in Application.
How ? Adding [Web Methods] Attributes with a method does not convert it into a web service.
You can create a separate web service for that, or you can add webservice in your current web application, which will add a webservice.cs file in your app code and do the rest thing by calling the WS.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Thank you,
i have a web service for my project that i connect to data base with it.
i don't have problem with creating web service,but i couldn't create a function for this code.
How i can return result and use it in my application?
when i use dataset i returned dataset:
<webmethode()>
Public Function getusers() as DataSet
dim da as new sqldataadapter
dim ds as new dataset
.
.
.
.
da.fill(ds,"Tbl")
return ds
end Function
and i use this code in my application:
protected sub btn1_click(....................)
dim ws as new localhost.service
gridview1.datasource=ws.getusers()
gridview1.databind()
end sub
now i have that code for submit button , only i don't know how i can write it in webservice instead of application?
<WebMethod()> _
Public Function FillAccordion() as ?????????
Dim cn As New SqlConnection
Dim cls As New ClsGeneral
cn.ConnectionString = cls.GetConnection
cls = Nothing
Dim cmd As SqlCommand = New SqlCommand("SELECT Title, Abstract FROM Articles", cn)
cn.Open()
cmd.ExecuteReader()
cn.Close()
return ????????
End Function
i couldn't write that code using function in web service and use function in submit button!
Hoda
modified on Tuesday, April 14, 2009 8:47 AM
|
|
|
|
|
Hi all,
Is there a way that i can use inline and attachment at the same time in content-disposition for Response Headers?
i have code like this
HttpContext.Current.Response.AddHeader("Content-disposition", "inline; filename=__aaa.pdf");
I want to open the file first in the browser and then open the dialog box for download as well.
How can i do that?
I tried to AddHeader again after that line of code and replaced the "inline" with "attachment", but that didn't work.
Please help me.
Thanks alot!
-ewin
|
|
|
|
|
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", "attachment;filename=Report.xls")
Response.Write(l_objStrBuilder.ToString)
Response.Flush()
Response.End()
try this way is help ful or not
|
|
|
|
|
Dear all,
I want to know how to send automatic email notification taking email address from database and send each one ema il according to there status for eg :- Choose email from database of status 1 and send them birthday message and for status 2 membership end message etc and each message template can also be picked by database.
As this can be done on regular basis, I know it can be done by window service but how it can be used with c# and sql server 2005
If any one of you have code than Please Post it.
Thanks u all for your support
RAHUL TANDON
|
|
|
|
|
rahultandon1000 wrote: As this can be done on regular basis, I know it can be done by window service but how it can be used with c# and sql server 2005
So, what is you problem ? You want to create a Windows services which will regularly check your database and send the notification mail to the user ?
If yes, then what is the point to post this question in ASP.NET Forum.
You have to create a simple web service, which will call Some SP of of SQL server and retrieve the data from database.
By the way you can do all the thing only using SQL server 2005 also
|
|
|
|