|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ASP.NET ProblemI have the following piece of code. In reality it is a menu which has more options. The main idea was taken from the following link. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_fp2003_ta/html/OfficeFrontPageCreateDropDownMenu.asp <table class="navbar" width="100%"> <tr> <td class="menuNormal" width="20%"> <p>Sign out</p> </td> </tr> </table> On the sign out option I require an onmousedown() event, that when fires, does the following operations. { Session["UserID"] = ""; Response.Redirect(...to login page); } Can someone help me doing it. Thanks in Advance onmousedown is a client side event. You can't have server side code firing
on a client side event, unless there is client side code to call the server. In general, asp.net questions should be asked in the aspnet forum. Show quoteHide quote "Xarky" <bernardp***@yahoo.com> wrote in message news:bc42e1a.0503280723.73119187@posting.google.com... > Hi, > > I have the following piece of code. In reality it is a menu which has > more options. The main idea was taken from the following link. > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_fp2003_ta/html/OfficeFrontPageCreateDropDownMenu.asp > > > <table class="navbar" width="100%"> > <tr> > <td class="menuNormal" width="20%"> > <p>Sign out</p> > </td> > </tr> > </table> > > On the sign out option I require an onmousedown() event, that when > fires, does the following operations. > > { > Session["UserID"] = ""; > Response.Redirect(...to login page); > } > > > Can someone help me doing it. > Thanks in Advance Hi,
You should better use a button for that. cheers, -- Show quoteHide quoteIgnacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Xarky" <bernardp***@yahoo.com> wrote in message news:bc42e1a.0503280723.73119187@posting.google.com... > Hi, > > I have the following piece of code. In reality it is a menu which has > more options. The main idea was taken from the following link. > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_fp2003_ta/html/OfficeFrontPageCreateDropDownMenu.asp > > > <table class="navbar" width="100%"> > <tr> > <td class="menuNormal" width="20%"> > <p>Sign out</p> > </td> > </tr> > </table> > > On the sign out option I require an onmousedown() event, that when > fires, does the following operations. > > { > Session["UserID"] = ""; > Response.Redirect(...to login page); > } > > > Can someone help me doing it. > Thanks in Advance You could use javascript to redirect to a page
that handles the logout. It is also possible to do it on the server side. Web controls such as LinkButton, support Click event. But then you'll have to populate the menu on the server side. "Xarky" <bernardp***@yahoo.com> wrote in message http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_fp2003_news:bc42e1a.0503280723.73119187@posting.google.com... > Hi, > > I have the following piece of code. In reality it is a menu which has > more options. The main idea was taken from the following link. > > ta/html/OfficeFrontPageCreateDropDownMenu.asp Show quoteHide quote > > > <table class="navbar" width="100%"> > <tr> > <td class="menuNormal" width="20%"> > <p>Sign out</p> > </td> > </tr> > </table> > > On the sign out option I require an onmousedown() event, that when > fires, does the following operations. > > { > Session["UserID"] = ""; > Response.Redirect(...to login page); > } > > > Can someone help me doing it. > Thanks in Advance Hi
I tried it with the following code, and it worked. But is this the correct way to do it? <a href=Login.aspx onmousedown="<% Session["UserID"] = "";%>"> *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! No it doesn't work.
This line logs the user out, every time the page is accessed. You really need a better understanding of client / server programming. Try this: <a href="Logout.aspx" >Logout</a> Logout.aspx should contain this line: Session["UserID"] = ""; Show quoteHide quote "xarky d_best" <bernardp***@yahoo.com> wrote in message news:#cBPKXCNFHA.3960@TK2MSFTNGP12.phx.gbl... > Hi > > I tried it with the following code, and it worked. But is this the > correct way to do it? > > <a href=Login.aspx onmousedown="<% Session["UserID"] = "";%>"> > > > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it!
Other interesting topics
Why exception when going through the DataSet?
VB to C# Convetting string/text to datetime How to show a datetime field in a TextBox Question about Sockets Problem with deriving System.EventArgs setting security from code C# as IE Control Invoke on Dialog not yet shown Programmatically retrieving photos |
|||||||||||||||||||||||