Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 11th, 2012, 08:33 PM
Registered User
 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Problem with login control and Master Pages

Hi everyone,
I'm new here, I'm not that good at English (so, sorry for the errors), I'd like to have some help with login controls, I added a login control inside a content page(based on a masterpage which in turn is based on another one), but it does not work at all, it just refreshes the page(nothing happens) and the password textbox is cleared, besides the ASPNETDB.MDF database is not created, however when I put a login control in a webform based on no masterpage, it works perfectly(database is created), I've been googling about it and found that there might be a problem with the Client ID of the login control, since the name of the control is prefixed with the auto-generated ID of the masterpage,I'm still a beginner with ASP.NET, so I have no idea how to deal with this problem,Here's is the source code for my site

-------------------------------------------------------------
Source code for FrontEnd.MasterPage:
Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title> </title>
<link rel="stylesheet" type="text/css" href="/App_Themes/MasterPage/Styles/base.css" />
<link rel="stylesheet" type="text/css" href="/App_Themes/MasterPage/Styles/layout.css" />
<link rel="shortcut icon" href="/App_Themes/MasterPage/Images/favicon.ico" />
<asp:ContentPlaceHolder ID="Head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
	<form id="form1" runat="server">
	<asp:ScriptManager ID="ScriptManager1" runat="server">
		<Scripts>
			<asp:ScriptReference Path="~/Script/BuiltIn/jquery-1.6.4.min.js" />
			<asp:ScriptReference Path="~/Script/Custom/base.js" />
		</Scripts>
	</asp:ScriptManager>
	
<div class="clear"></div>
		<div id="content">
			<asp:ContentPlaceHolder ID="cpMainContent" runat="server">
			</asp:ContentPlaceHolder>
		</div>
</body>
</html>
------------------------------------------------------------

Soruce code for ContentPage.master based on FrontEnd.master:

Code:
<%@ Master Language="C#" MasterPageFile="~/MasterPages/FrontEnd.master" AutoEventWireup="true" CodeFile="ContentPage.master.cs" Inherits="MasterPages_MasterPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head" Runat="Server">
	<link rel="stylesheet" type="text/css" href="/App_Themes/ContentPage/Styles/base_cp.css" media="all" />
	<asp:ContentPlaceHolder ID="HeadContent" runat="server">
	</asp:ContentPlaceHolder>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
		<Scripts>
			<asp:ScriptReference Path="~/Script/Custom/base_cp.js" />
		</Scripts>
    </asp:ScriptManagerProxy>
	<div id="breadcrumbs">
		<asp:Label ID="Breadcrumbs" runat="server" Text="" />
		<span class="feedback"><a href="">Enviar Comentario</a></span>
	</div>
	<div class="clear mt10"></div>
	<asp:ContentPlaceHolder ID="MainContent" runat="server">
	</asp:ContentPlaceHolder> 
</asp:Content>
----------------------------------------------------------------
Source code for login page based on ContentPage.master:

Code:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/ContentPage.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Users_Login" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
	<div id="left-main">
	</div>
	<div id="right-main">
		<h1>Ingresar y ve tu Cuenta</h1>
		Ahun no tienes una cuenta?, que esperas,<a href="">Registrate Ahora</a>
		<br />
		<asp:Login ID="Login1" runat="server" DestinationPageUrl="~/Default.aspx" 
			EnableTheming="False" >
		</asp:Login>
		<asp:LoginStatus ID="LoginStatus1" runat="server" />
	</div>
	<div class="clear"></div>
	<div id="main">
	</div>
</asp:Content>
----------------------------------------------------------------
I've also based my login page in just one masterpage but it still does not work(however PlanetWrox login page works nicely[I'm reading Beginning ASP.NET 4 in C# and VB] and it's also based on a masterpage), So i don't know what's wrong with my website.I figure that there might be a problem with CSS or maybe some IDs. I've red that some people have similar problems with bulit-in controls like the login control, Well, I hope someone can help me thanks in advance

Last edited by juanch246; January 11th, 2012 at 09:54 PM..
 
Old January 12th, 2012, 05:13 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Can you upload a sample project somewhere with the minimal web site that shows how to reproduce the problem? Makes it easier for me to see what's going on.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 12th, 2012, 06:29 PM
Registered User
 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi again Imar, thanks for replying
I just uploaded the source code of my website

You can download it from here:

http://www.4shared.com/rar/jjFFfAwr/website.html

I put the login page in ../Users/Login.aspx, as I metioned previously when I create a webform based on no masterpage the login control works fine but my Login page based on my masterpage don't,
I'll be wainting for you response thank you.

PS: I've just noticed that if I put a simple button inside a page based on my masterpage, its button event does no work I guess that's the problem with the Login control. The point is why events are not firing in my website.

Last edited by juanch246; January 12th, 2012 at 08:07 PM..
 
Old January 13th, 2012, 01:29 AM
Registered User
 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default I solved the problem

I just solved the problem, My problem was caused by an old jQuery script that I used to disable the submit buttons when they were clicked. I thought It wouldn't affect the server controls but somehow it makes the controls' events not to fire correctly.

the script I used contained the following code:
Code:
 $(this).find('input[type=submit]').attr('disabled', 'disabled');
After removing this from my site the login control and other controls started working.
Maybe you can explain it better (would be great)
Sorry for any inconvenience I might have caused, After all I'm still a novice
I'll keep reading your books, they're so good.
Thanks
 
Old January 13th, 2012, 06:13 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
I'll keep reading your books, they're so good.
Thank you, and good to hear you resolved the problem.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
The Menu Control and master pages malie22001 BOOK: Beginning ASP.NET 4 : in C# and VB 4 December 18th, 2011 03:50 PM
Problem with Nested master pages SouthendSupporter ASP.NET 3.5 Basics 1 March 3rd, 2011 10:15 AM
Problem accessing Request.Form with Master Pages kittu_asa ASP.NET 2.0 Basics 1 February 28th, 2008 09:38 AM
Problem in nested master pages. harsh.kintu ASP.NET 2.0 Professional 2 January 9th, 2007 10:04 AM
Master pages &server control ID - asp.net 2.0 tech user C# 2005 1 August 3rd, 2006 04:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.