.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Sub Page_Load - not working in the content page.

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
Hi there,I am using a content page (tellafriendaction.aspx) which uses a master page (PublicMaster.Master)The masterpage Page_Load event (in the code behind page) is working and is called when tellafriendaction.aspx page is called.But the Page_Load event in the content page (tellafriendaction.aspx) is not working or is not called when i call the content page while i am debugging the application.(Note: I have an html form in TellAFriend.aspx content page. It submits the form to TellAFriendAction.aspx page, which should capture the form content and send the friend an email message.)Here is some code samples:=================tellafriendaction.aspx.vb (code behind page for the content page)==================Imports System.ConfigurationImports System.WebImports System.Web.SecurityImports System.Web.UIImports System.Web.UI.WebControlsImports System.Web.UI.HtmlControlsImports System.Net.MailPartial Class tellafriendaction    Inherits System.Web.UI.Page    Sub Page_Load 'this method is not being called WHY?        Dim emailFromAddress As String = Master.Request.Form("txtFromEmailAddress")        Dim emailToAddress As String = Master.Request.Form("txtToEmailAddress")        Dim fromName As String = Master.Request.Form("txtFromName")   &nb

View Complete Post

More Related Resource Links

'Edit content' link is not working on article page



I am using MOSS 2007. I am using custom master page, custom theme, and custom page layout for my portal site. I have created one article page, but 'Edit content' link is showing some javascript error. If I set out-of-box default.master as master page, then its working fine. But its showing me JS error with my custom master page. What could be the reason?

Its very urgent. Please response.

Content Editor Webpart not working in web part page


I Have a CEWP, i have written jquery for displaying the same.It works fine when i do the following:

Site Actions --> Edit page -->Add a Webpart --> CEWP --> and in the Source control editor, i paste the jquery. My jquery does a calculation by comparing two values A and B in a list. If A is greater, one image is shown, if it is less another image will be shown.When the user clicks the image the list gets opened and on the change in the values the image will be changed. This works perfectly when i do the above.

But when i create a Webpart page, it gets created in the Shared Documents site. And when i add a web part and does the same thing, my CEWP is not showing the correct image.




Unique content within master page based on conditions met


 Hi all-

I would like to present users with unique content based on certain conditions being met as they land on the home page (default.aspx).  The condition logic will be in the VB code behind Page Load event. The content will go in a content placeholder as specificed from the master page. 

However, the content change wouldn't be something small (ie making a panel or label visible or not) but rather it will be different HTML,  Divs and databound gridview content.  The HTML content will be stored in the database.

Can someone point me in the right direction for best practices on how to accomplish this?


Passing Linq Statement between master and content page


I usually work with windows forms, and am just starting to work with ASP.Net, so appologies if this is a dumb question!

I have a master page which has a search button on it. The results of this are built up using a Linq statement and if there are any results, I want to display the results in a contents page.

On the masterpage, I have the following code:

Private _res

    Public Overridable ReadOnly Property SearchRes()
            Return _res
        End Get
    End Property

 Private Sub DoSearch()
   'some code to get a linq result

    If res.Any Then
            _res = res
            Server.Transfer("SearchResults.aspx", True)
            'no results
            LabelNoRes.Visible = True
        End If
 End Sub

On the SearchResults.aspx page I have this code.

Dim m As pxSite = CType(Page.Master, MasterPage)
        If m.SearchRes IsNot Nothing Then
            Label1.Text = "Results found = " & m.SearchRes.Count
        End If

m.searchRes is always nothing. 

What am I doing wrong here?


JQuery Treeview plugin is not working with Ajax page load in ie8


Hi there,

I developed a page where i m using jquery treeview plugin to generate tree. It worked fine on FF, IE8 with out ajax.

But when my page loads thro' ajax call in IE8, it is not collapsing or expanding tree.

Any idea?

Thanks in advance.

Content page control passes as argument to javascript function


Here is the content page:


<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="JavaDynamicCopyValue.aspx.cs" Inherits="JavaDynamicCopyValue" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <script type="text/javascript" >
 function copyValue(input, output )
   ouput.value = input.value;
   return true;
 <asp:TextBox ID="txt1" runat="server" onchange="copyValue(this,document.getElementById('<%=txt2.ClientID%>'))"></asp:TextBox>
    <br />
    <br />
    <asp:TextBox ID="txt2" runat="server"></asp:TextBox>


I got a javascript run time error says output is undefined. if I view source of the page, the txt1 markup became:

<input name="ctl00$ContentPlaceHol

update panel in content page



iam using master page  and i am using update panel in content pages (child pages)

my questions is that can use updatepanel in every child page or  master page only.

give ur suggestions, i have senario , in a page i have file upload concept ,updatepanel

is not support that fileupload.

Content deployment: pages not based on a page layout

Is it possible to use content deplyoment feature when pages (in page library) are not based on a Page Layout?

SharePoint 2007 - Consolidating everything as feature into WSP [Content Type, Page Layout, Pages, Ma


Hello –


Overview – We are building a Mobile Web Site using SharePoint 2007. The big screen site has been already built and we need to integrate the mobile site into same site collection of big screen –


·         The Mobile site will use the existing content types of existing big screen site

·         We will build a new custom Master page

external content not load in page like style and js in asp.net mvc when i use area


i am working on a asp.net mvc 2 website who have a area and i have a problem with them.

i use different different url routing for application settings. i have two folder called style

first folder location in main directory  /Style/style.css

second folder location in Area area/style/style.css

everything is work fine in application but when i used style.css from main directory in my area's views then style not worked. when i track them from firebug then i got error "The resource could not be found" but path is correct.

sombody tell me to use absolute path to solve this issue. how i can use absolute path to declare resource url in views.

any suggestion , sollution on this issue who can help me to solve this issue.

Web Part working fine on the top-level page but 'Not Safe' error on lower-level pages.


I have created a Web Part which reads and parses the SharePoint logs in order to display usage information of the page it resides on.  The Web Part works perfectly on the top page, reading and displaying the information desired.  However, once the Web Part is added to any page lower in the site heirarchy (sub-page) the same Web Part throws the following error:

Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.

Show Error Details
Hide Error Details

[UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.]
  at Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Guid guid)
  at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)

Of course the current version of the Web Part is in the SafeControls list on the web.config.

The Web Part was originally designed to return site activity only for the top default.aspx page and worked fine but started to fail in the manner described above once I added the following line of code to return a SPCo

Request.PathInfo losing Master Page content and CSS link


Hi All-


I'm using Request.PathInfo to response.redirect as user to a different page ( based on the content after .aspx ).  It redirect just fine however, once redirected, the page loses all content from the master page and the CSS link.  I've searched and can't find an answer. 

Does anyone have a solution for this?

Change label text on master page from the content page.

Hello. Can I access the objects (for example change the label text) on the master page, from its contents page code? If yes, how can I approach that? Thank you Artashes

bind drop down list in content page from value from master page

Hi all, I have applied nested master page to some page. Now i want to bind drop downlist from value selected in dropdown list in master page of master applied to that page. the hierarchy of pages is  mypage.aspx -> main.aspx -> inner.master I want bind dropdown list in  mypage.aspx from  from value selected in dropdown list in  inner.master Please help me. 

Load content to the page with in XML?

I'd like to find out about the best technique to generate multiple container boxes/thumbnails of the content with xml that are loaded into wrap panel. It can be stackpanels or listboxes with textblocks and checkboxes in them. Any sample or helpful source of information is highly appreciated. Thank you in advance.

inline css within content page

Hello, I have a question for the group.  I have a master page with several content pages I a working with.  On the content pages, I would like to make a few changes, such as adding images inside the content area.  When adding images, there are a few properties, such as borders that I can add.  However, it appears that this has limitations.  When I try to add some CSS at the top of the content page, I get a few errors.  I would like to add things such as padding around the image to make the appearance more presentable.  Can someone recommend how to do this? thanks 

GetRouteUrl() not working on Master page

Hi, I'm facing odd problem with Page.GetRouteUrl() method. It is working only on regular content pages and doesn't want to work on my master pages. I'm using simple snipet: <%# Page.GetRouteUrl("Default", null).ToString() %>, when I put it on some page, it generates "/Default", when I put it on master - I get "". I've tried calling Master.GetRouteUrl() instead but still no luck, it always returns empty string. Funny thing is that it works in code behind (bothPage.GetRouteUrl() and MAster.GetRouteUrl() works) of the master page, only markup seems to be affected. I bet it is somehow related to the configuration since I have recently moved from ASP .NET 3.5 to 4.0 on IIS7 with integrated pipeline. Anyone have any clues?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend