LoginStatus not working within master page
-
I have a user control on my site (in directory UserControls/UserInfo. When I drop the control onto a page created from my master page template, it does nothing (i.e. you click on the "login" link and nothing happens). I even added an explicit link to a Login.aspx url on the LoginStatus line, which will work. However, the LogOut link does not work. I've found I can drop this user control onto any new, blank (i.e. not derived from MasterPage.master) and all works as expected. Also, when I run in debug mode, I get the following error when I click on the Login link: "Microsoft JScript runtime error: Object doesn't support this property or method" The method highlighted is: "theForm.submit();" This call is in the javascript function created to do the postback: function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } The javascript issues I just listed may be a red herring. I've included the user control code below. Any assistance on why this doesn't work within master pages would be helpful and greatly appreciated. <%@ Control Language="C#" AutoEventWireup="true" CodeFile="UserInfo.ascx.cs" Inherits="UserControls_UserInfo" %>
ReelPushMowers
Catalog AdminWelcome!
You are not logged in.
-
I have a user control on my site (in directory UserControls/UserInfo. When I drop the control onto a page created from my master page template, it does nothing (i.e. you click on the "login" link and nothing happens). I even added an explicit link to a Login.aspx url on the LoginStatus line, which will work. However, the LogOut link does not work. I've found I can drop this user control onto any new, blank (i.e. not derived from MasterPage.master) and all works as expected. Also, when I run in debug mode, I get the following error when I click on the Login link: "Microsoft JScript runtime error: Object doesn't support this property or method" The method highlighted is: "theForm.submit();" This call is in the javascript function created to do the postback: function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } The javascript issues I just listed may be a red herring. I've included the user control code below. Any assistance on why this doesn't work within master pages would be helpful and greatly appreciated. <%@ Control Language="C#" AutoEventWireup="true" CodeFile="UserInfo.ascx.cs" Inherits="UserControls_UserInfo" %>
ReelPushMowers
Catalog AdminWelcome!
You are not logged in.
...make sure that you don't have any other form controls on your page that have ID="submit". This caused the same error on my system whilst converting an HTML layout to ASP.NET because JavaScript was referencing a form element called submit, rather than the submit() method of the form.