CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 6/1/2006 9:17:47 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 15 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
6 Items, 1 Pages 1 |< << Go >> >|
GeorgieBR
Asp.Net User
Problem declaring forms on master page6/1/2006 9:17:47 AM

0/0

Hi All, hope you can help with this (I'm not great with ASP!)

I have a master page with several user controls. One user control is a basic user status display with a linkbutton to allow the user to log out.

This caused an error because it said the linkbutton had to be inside a <form> declaration. Because you can't declare a <form> inside a user control I opened up the <form> element on the master page to cover the entire page (include the dropped in user controls). All worked well .... until I then put some serverside controls in the master page's placeholder - now I get the same error for the code inside the placeholder.

It seems the master page is getting confused between whether the user control or the placeholder is inside it.

Any help greatly appreciated!

PS I'm sure this has been posted somewhere else, but the search isn't great on here!

bmains
Asp.Net User
Re: Problem declaring forms on master page6/1/2006 12:18:33 PM

0/0

Hey,

You put some controls in the masterpage's contentplaceholder in the master page or the content page?  You can't put controls in the masterpage's contentplaceholder, as that is a designation to mark the <asp:Content> regions on the content page...  Seeing the html would help solve this problem also.


Brian

"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4).
orzeh
Asp.Net User
Re: Problem declaring forms on master page6/1/2006 12:21:14 PM

0/0

hi!

remember to add to form tag runat="server" attribute.
sample:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<%@ Register Src="SampleControl.ascx" TagName="SampleControl" TagPrefix="uc1" %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
            <asp:Button ID="Button1" runat="server" Text="Button" />
        </asp:contentplaceholder>
        <uc1:SampleControl ID="SampleControl1" runat="server" />
    </div>
    </form>
</body>
</html>

orzeh


code less, think more!
GeorgieBR
Asp.Net User
Re: Problem declaring forms on master page6/1/2006 1:13:15 PM

0/0

Thanks for the prompt reply!

I have a master page with a placeholder (for the bits that I customise on each page). But I have added a user status to the top of the master page (because I want it to appear on every page). When I added this user status control I had to widen the <form> to cover the whole master page to make it work.

I guess what you're saying is that the master page should only have place holders. Then I should drop the user status into each page that I use (ie make a placeholder for the user status in the master page rather than making it part of the master page)?

This would be long-winded but reasonably easy. I guess I could be expecting too much of master pages!

GeorgieBR
Asp.Net User
Re: Problem declaring forms on master page6/1/2006 1:14:33 PM

0/0

Yep, definitely got runat="server" on the form elements.
bmains
Asp.Net User
Re: Problem declaring forms on master page6/1/2006 4:43:08 PM

0/0

Hey,

That's not what I'm saying at all; it made it seem like this user status control was defined between <asp:ContentPlaceHolder></asp:ContentPlaceHolder> elements, which isn't allowed.  I think we won't be able to help you unless we can see what is going on.  Could you post the master page HTML and one of the content page HTML that you were having problems with?


Brian

"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4).
6 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Beginning ASP.NET 2.0 in VB 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1063, Published: 2006
Professional ASP.NET 2.0 Authors: Bill Evjen, Scott Hanselman, Farhan Muhammad, Srinivasa Sivakumar, Devin Rader, Pages: 1253, Published: 2005
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional Authors: Matthew MacDonald, Pages: 954, Published: 2007
Professional ASP.NET 3.5: In C# and VB Authors: Bill Evjen, Scott Hanselman, Devin Rader, Pages: 1673, Published: 2008
Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007
Dreamweaver CS3 Bible: Master Every Aspect of Dreamweaver - Work with CSS, Text, Images, And Links - Incorporate Flash Movies and Other Media Authors: Joseph W. Lowery, Pages: 1112, Published: 2007
Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1148, Published: 2006
Programming ASP.NET: Building Web Applications and Services with ASP.NET 2.0 Authors: Jesse Liberty, Dan Hurwitz, Pages: 930, Published: 2005
Beginning ASP.NET 2.0 Authors: Chris Hart, John Kauffman, Chris Ullman, David Sussman, Pages: 759, Published: 2005
ASP.NET AJAX Programmer's Reference: With ASP.NET 2.0 Or ASP.NET 3.5 Authors: Shahram Khosravi, Pages: 1522, Published: 2007

Web:
Problem declaring forms on master page - ASP.NET Forums Problem declaring forms on master page. Last post 06-01-2006 12:43 PM by bmains. 5 replies. Sort Posts:. Oldest to newest, Newest to oldest ...
Master Pages In ASP.NET 2.0 Jul 18, 2005 ... Just like any ASPX form, our master page can contain code in a




Search This Site:










master page mystery event solution

login control on a masterpage with a button... enter not behaving

menu control and parent/child page problem.

how can i post and get the hidden values from child page

hide sub menu item

master pages + file path

first level menu hover issue

mulitple (nested) themes... can it be done?

how to set theme for the whole web application instead of a single web page

css not applied in any pages with a theme

setting title of content page

multiple root items on menu not showing up

system.configuration.provider.providerexception: this property cannot be set for anonymous users

[idea] master page htmlhead base tag

cannot use a leading .. to exit above the top directory

fixed column widht not working

masterpages and #includes

treeview and postbacks in ie

master page issues with sqldatasource

get selected value for sqldatasource select parameter located in content page from listbox located in master page

menu problem in firefox

rendering problem with asp:menu "skip navigation links" image

css theme class won't refresh

masterpage <head> content

subfolder, web.sitemap and selected

want to use base classes for code behing inheritance / shared logic

issue with usercontrol in masterpages

css in theme doesn't override original properties

css in content page

master pages with themes problem (how to i convert c# code to vb)

  Privacy | Contact Us
All Times Are GMT