CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 2/9/2006 4:09:38 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 42 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
Nemisis
Asp.Net User
Loading a master page and a user control2/9/2006 4:09:38 PM

0/0

Hi everyone,

I have created a Master Page and set a content page to it, using the page directive which is all fine.

On my content page i add a user control, which registers javascript from within the user control, the code is

If Not (Page.IsClientScriptBlockRegistered("js")) Then
    Page.RegisterClientScriptBlock("js", jsFunc)
End If

But for some reason the javascript doesnt appear if i look at the html source file, once the page is a content page of a master file.

If i create the same page, but dont set the page to be a content page of a master file, then it works fine.

Have i got to use something else rather then Page.IsClientScriptBlockRegistered??

Also, if i create a property on my master page to change the html title, the content page wont find the master page property??!! HELP!!

Thanks in advanced.

kashif
Asp.Net User
Re: Loading a master page and a user control2/13/2006 3:34:32 PM

0/0

Nemisis, I tried to reproduce this behavior but have been unable to - here is what I had

<code>

master

<%@ Master Language="C#" %>

<script runat="server">

protected void Page_Load(object sender, EventArgs e)

{

if (!Page.IsClientScriptBlockRegistered("js"))

Page.RegisterClientScriptBlock("js", "<script>alert('master page')</" + "script>");

}

</script>

<form id="form1" runat="server">

<div>

<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">

</asp:contentplaceholder>

</div>

</form>

content page

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>

<%@ Register Src="WebUserControl.ascx" TagName="WebUserControl" TagPrefix="uc1" %>

<script runat="server">

protected void Page_Load(object sender, EventArgs e)

{

if (!Page.IsClientScriptBlockRegistered("js2"))

Page.RegisterClientScriptBlock("js2", "<script>alert('content page')</" + "script>");

}

</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<uc1:WebUserControl ID="WebUserControl1" runat="server" />

</asp:Content>

user control

<%@ Control Language="C#" ClassName="WebUserControl" %>

<script runat="server">

protected void Page_Load(object sender, EventArgs e)

{

if (!Page.IsClientScriptBlockRegistered("js1"))

Page.RegisterClientScriptBlock("js1", "<script>alert('user control')</" + "script>");

}

</script>

</code>

Can you provide your code which is not working?

Also for the issue regarding the master page prop not accessible in the content page - did you add a MasterType directive to your content pge refrencing your master?

Thanks,

Kashif

Nemisis
Asp.Net User
Re: Loading a master page and a user control2/14/2006 4:47:16 PM

0/0

Kashif,

Thanks for your example, i have downloaded it and messed around with mine, then in the end, realised i didnt have the form element on the master file. Duh!

I havent put in a MasterType directive, i will read up on that and see what it does and where to put it.

Thanks again

 

kashif
Asp.Net User
Re: Loading a master page and a user control2/15/2006 6:52:15 PM

0/0

A simple example of accessing a property from your master would look something as follows

<code>

on master page - masterpage.master

...

public string MyTitle {

...

}

...

on content page

<%@ Page masterPageFile="~/masterpage.master" %>

<%@ MasterType virtualPath="~/masterpage.master" %>

...

Response.Write(Master.MyTitle);

...

</code>

Thanks,

Kashif

4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages Authors: Jacob J. Sanford, Pages: 474, Published: 2007
Beginning ASP.NET 2.0 in VB 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1063, Published: 2006
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional Authors: Matthew MacDonald, Pages: 954, Published: 2007
Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
Expert C# 2005 Business Objects Authors: Rockford Lhotka, Pages: 668, Published: 2006
ASP.NET 2.0 Website Programming: Problem-design-solution Authors: Marco Bellinaso, Pages: 576, Published: 2006
Beginning ASP.NET 2.0 Authors: Chris Hart, John Kauffman, Chris Ullman, David Sussman, Pages: 759, Published: 2005
ASP.NET 2.0 Instant Results Authors: Imar Spaanjaars, Paul Wilton, Shawn Livermore, Pages: 456, Published: 2006
Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1148, Published: 2006

Web:
Loading a master page and a user control - ASP.NET Forums Re: Loading a master page and a user control. 02-13-2006, 10:34 AM. Contact ... Re: Loading a master page and a user control. 02-14-2006, 11:47 AM. Contact ...
ASP.NET 2.0 loading priority-master page,user control,web page loading priority-master page,user control,web page i my project i have a masterpage that contains more then on usercontrols , i my web page i add the ...
Put loading panel in a Master Page? - telerik Forum I did get it working by using a AjaxManager on the usercontrol: ... would then just have to send the MasterPage loading panel to control. ...
CodeProject: ASP.NET Discussion Boards. Free source code and ... Answer, Re: Master page dynamically loading User Control, member, doWhileSomething, 10:02 22 Jul '07. If your using the load control method, you do not need ...
Master Page Loading Path Problem - DevX.com Forums Master Page Loading Path Problem ASP.NET. ... User Control Panel, Private Messages, Subscriptions, Who's Online, Search Forums, Forums Home ...
Loading a usercontrol from a different usercontrol [Archive ... I've got the masterpage structure working. In that child page I dynamicly loaded a usercontrol fromout the Page_Load. Into that usercontrol ...
using master page : The Official Microsoft Silverlight Site But you Can Create Different User Control kind of thing for different ... you can create master page then. PregnantBySilverlight. Loading. ...
MasterPage vs User Control - ASP.NET Forums MasterPage just included header and footer, however I came across another solution that shows the use of User Control (create footer.ascx ...
User Control on Master Pages : master, page, user, control The problem is the order in which the page loads, which is: 1) Master page loading 2) User control loads 3) Objectdatasource for the gridview updated ...
Master Page Inheritance and User Controls - Rick Strahl's Web Log Microsoft Advertising loading... Ads Via DevMavens ... In my example the master page contains a user control CategoryList.ascx: ...

Videos:
A New Way to look at Networking Google Tech Talks August 30, 2006 Van Jacobson is a Research Fellow at PARC. Prior to that he was Chief Scientist and co-founder of Packet Design. P...
Charlie Rose - Tim Russert / Boone Pickens Segment 1: Tim Russert, moderator of "Meet The Press" discusses his new book, "Wisdom of Our Fathers". Segment 2: A conversation about energy with...




Search This Site:










treeview control

how to access the navigateurl of child of treeview in masterpage to content page?

error when ftp dnn site to live webserver

error dotnetnuke.services.exceptions.moduleloadexception:

trialware -what is good to integrate into a product for use

treeview problems (asp.net 2.0)

creating a blog gives error

how to get username & password automatically from......

looking for web hosting

publishing a website

how to get membership related data row?

what makes request.isauthentication true????

non sql server 2005 authentication

different controls of one module on different tabs?

error <module> is currently unavailable

solution with a website, better to put website under solutions' folder

default settings - login page/tab 3.0.7

help me for language selection

how can i generate crystal report in dnn3 ? it gives me serialization error

.sln files and how to add an ascx???

need help using control adapters at the machine level

windows authentication on hosted server

tabstrip & client-side event ?

sitemap problem when transfered to iis 6

logout help

login control (asp.net 2.0) doesn't work no matter how i tried

custom provider help

dnn user group [the netherlands]

uip questions

mysql version of club starter kit

 
All Times Are GMT