Controlling Site From Master Page?

Mar 25, 2011

I have a web app that contains 1 master page and a bunch of content pages. One of the content pages is "SysLogin.aspx", which is called from a menu option from the Master Page. When the page is called, the user logs in. However, there is a "Login" button. In the code behind of the Login_Click() event, the the user successfully logs in, they are supposed to be redirected to a "Default.aspx" page and the Main Menu is enabled. Problem is, the app hangs on the redirect statement and it goes to the Catch portion of the Try Catch construct. For some reason, when I examine the exception, it only says "Unable to evaluate expression". Below is my code. My question, other than what I've stated is...should your application be controlled using code in the Master Page or in child pages. My code from the "SysLogin.aspx" is below. It hangs on the highlighted line of code.

Private Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
Try
If txtLoginID.Text.Length > 0 Then
If txtPassword.Text.Length > 0 Then
If dbIO.ValidateUser(txtLoginID.Text, txtPassword.Text) Then
Session("LoggedIn") = txtLoginID.Text
Session("loggedInOk") = "Y"
Response.Redirect("~/Admin/Default.aspx")
End If
End If
End If
Catch ex As Exception
Master.errMsg = dbIO.DisplayError("btnLogin_Click()", "SysLogin", ex.Message)
End Try
End Sub

View 1 Replies


Similar Messages:

MVC :: Create A Dynamic Field In The Master Page (site.Master)

Oct 10, 2010

I'm starting with ASP.NET MVC (1.0). I have a problem to resolve. I have developed a web applicaton (an application of articles like e-commerce) with a head (logo and menu). I have defined the head (logo and menu) in the Master page (site.master). Now, I must display the number of articles in the head in a field (like the number of articles in the virtual basket in the e-commerce). I can read the number of articles in the data base (in the controller), but i can't integrate it in the master page.

View 1 Replies

Web Forms :: Master Page (site.Master) File That Now Contains Nothing But Hex Code, Mainly 0's And 1'...

Feb 3, 2011

My computer system froze on me, the mouse froze, cntrl-alt-del, did nothing, so I reset it. Did a disk check, and now everything seems fine except for my master Page html code which I was in the middle of editing when it happened. The VB code-behind file is still ok, the designer file still shows ok with all of the controls in it, but I can't get into desgn or source view. It just opens and gives a whole page of hesixecimal code such as as:

00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

It just gives me a whole page full of numbers like this. I haven't backed up for a few weeks and so I hope I can get this back.

View 3 Replies

Web Forms :: Updating A Master Page Label Per Page On Site?

Dec 13, 2010

I have a label within my master page that is part of our footer. In the footer, we are wanting to display page specific information. So as you make your way around the site, the footer will contain content about that page along with other data that is universa on the entire site.I had a somewhat similar question some time back that i posted here..

http://forums.asp.net/t/1615850.aspx it was for a shopping cart of sorts..

cartct.Text = ShoppingCart.Instance.Items.Count().ToString() + " Items In Cart";

If Label is in master page, you have to use FindControl to get the Label and udpate its text

((Label)Master.FindControl("cartct")).Text=String.Format("{0} Items In Cart",ShoppingCart.Instance.Items.Count() );

once you select another page, you dont have it anymore,If you want to share data across different pages, consider using Session to save Items count.

View 6 Replies

Web Forms :: Dynamic Site Map In Master Page

Jan 30, 2010

I have a simple SiteMapPath in my master page like below.
<asp:SiteMapPath ID="SiteMapPath1" runat="server" SkinID="SiteMap" Visible="true" /><br />
Also I use Web.sitemap and include all static sitemap pages. In my Web.config, I have this:
<siteMap enabled="true"/>
Currently, many pages uses this static site map for many projects and I'm not supposed to update the master page, but I need to have dynamic site map so that I can add query strings for each navigating pages.

View 2 Replies

Web Forms :: Set A Master Page Dynamically From Other Site?

Feb 4, 2011

I need to set master page dynamically from other site. I am trying this

protected
override
void OnPreInit(EventArgs e){
this.MasterPageFile =
http://localhost/site1/MasterPage/MasterPage1.master;
}

But it gives error

'http://localhost/site1/MasterPage/MasterPage1.master' is not a valid virtual path.

View 3 Replies

C# - Pass A Variable From Site.Master.cs To Site.Master

Mar 29, 2011

I'm new to C# web development. I'm trying to reference a param from Site.Master.cs in Site.Master, so that in Site.Master page, I can do:

<%
if (someParam == true) {
%>

some HTML code

<%
}
%>

The param someParam is the one I want to pass from Site.Master.cs.

View 3 Replies

Dropdown List In Header On Master.Site Page Can't Get The Data

Jan 29, 2010

I created a Site.Master page for my website. On the site.Master page I created a header that holds a dropdown list of companies. I was hoping that this dropdown list would be available to all pages, however the first page I made was a page with a grid view. I wanted to use the header dropdown list as one of the parameters to fill the gridview. That option does show up. I have all of the control on that actual page available to bind to, but not the Site.Master page.

View 5 Replies

Web Forms :: Using Site.master To Call Js Function When The Page Loads

May 27, 2010

I have a VS 2010 and have created some aspx content pages associated with a master page. I want to call a javascript function right when the page loads but am not able to find an onload client side event for these pages which are using asp:content as there only controls. I know that I can put content in them and I have but how do I call the client side onload event from the main content control?

View 4 Replies

Security :: Hiding Site Map Nodes From Master Page Dynamically?

Jul 30, 2010

I have a Master Page and on the Master Page I have a Site Map. What I would like to do is when a user logs on deending on the users permission I want to hide some of the Nodes on the Site Map.

View 2 Replies

JQuery Object Expected Error In .net Page With Master Site?

Oct 27, 2010

The error i get seems to be centered around jquery finding what it's in (window,document, etc.). Right now i'm just trying to implement the jQuery datepicker. the project has a master page, where i placed my script references.

<head runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />[code]...

I have tried document and window for jquery context, but they both throw the same error.

View 1 Replies

C# - To Apply Default.master Of The SharePoint Site To Aspx Page?

Mar 7, 2010

I am using SharePoint Server 2007 + C# + .Net 3.5 + VSTS 2008 + ASP.Net. And I am using collaboration portal template.

I am developing a custom aspx page and put it in _layout folder of a site and I want to apply default.master of the SharePoint site to this aspx page. Any samples about how to achieve this goal?

View 3 Replies

Web Forms :: Use The Master Page To Make A Full Border To The Site

Oct 21, 2010

I want to ask can I use the master page to make a full border to the site for example: [URL] and then put the content inside that, or I just only can use master pages to do headers and footers?

View 4 Replies

Why Did MVC Team Choose "../../Content/Site.css" Rather Than "~/Content/Site.css" In Site.Master Page

Dec 14, 2010

<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />

The above code shows an external css inclusion tag declared in Site.Master template.

My question: why did the Asp.net MVC team choose that way rather than using "~/Content/Site.css" ?

View 4 Replies

Web Forms :: From Site Master Page - Menu Disappears When Click On Any Button

May 15, 2012

I am using ASP: menu in my site.master page ' but when I clicked on any button or drop down from other page the menu is disappeared. Why my menu is disappearing from the site.master page ?

My code is :

<asp:Menu ID="MainMenu" runat="server" Orientation ="Horizontal"  CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" >
        <Items > 
        <asp:MenuItem  Text ="Home" NavigateUrl="AllEMP.aspx" >
              </asp:MenuItem>
            <asp:MenuItem  Text ="Menu" NavigateUrl ="~/Default.aspx">
                   </asp:MenuItem>
  </asp:MenuItem>
        </Items>
        </asp:Menu>

View 1 Replies

Web Forms :: Master Page To An Entire Website As A Method Of Implementing Site Security Consider?

Feb 21, 2010

I have a site with about 4 pages or so. I was asked to implement a very simple security (check if user in database, if not kick out) using active directory and validating against a table of users. I was simply thinking of createing a master page and making all pages inherit that master page. I would then authenticate the users from the master page.

View 4 Replies

Visual Studio :: Web Site / Web Application Templates Seem Changed - Default.aspx Only With Site.master

Oct 21, 2010

Using Visual Web Developer 2010 Express. I was used to creating a web app anytime and I would get a default page for starters and be happy. But today I find that when I pick either the ASP.NET Web Site or ASP.NET Web Application templates I get site.master and a bunch of site admin files that I don't want. Alternately when I select the empty versions of those templates, I get almost nothing at all. An almost empty web.config page and no Default.aspx page. There is nothing magical about having a default.aspx page in place, but it is an indicator of a change when I can only get a virtually completely empty website or a website with a bunch of bells and whistles I don't want.

Also, for some reason, when I create a new app or website as just noted, in the Solution Explorer I get aspx.designer.cs files showing as well as web.config files for both debug and release. Somehow some settings and templates must have changed, or am I missing something here? How can I get my settings/templates to go back to the way they were?

View 1 Replies

Authentication - Controlling Flow With Return;, Don't Render The Rest Of The Page?

Sep 15, 2010

this question should be fairly basic. I want to control the flow of an ASP.NET page -- if a certain condition is met, I want to write out an error message and stop drawing the page. However, I also want ASP.NET to output correct HTML (i.e. not cut off in the middle). Right now I am doing this:

if (condition != what-i-want) {
Label_Error.Text = "Sorry, you messed up";
return;
}

And the problem with that snippet is that ASP.NET draws the rest of the defined page without cutting off after the error. I really don't want to make the whole page Visible = False and then undo it when someone is authenticated. Is there some good way to do this? I have tried Response.End() but that doesn't output clean HTML (or anything actually, since I'm checking in Page_Load). I've had similar experiences with Response.Close(), et al.

View 1 Replies

State Management :: Master Page's Treeview Selected Node / Setting The Properties In Master Page?

Aug 2, 2010

I have a master page containing a tree and 3 dropdown lists. I am populating a context menu on right click of each node, and when clicked on any item of the context menu, it navigates to required pages.

My problem is after navigating to the required page, the selected values from the drop down lists and the selected node from the tree are getting cleared.

I can set the selected values for the dropdown lists by making some properties in master page.
But how do i maintain the selected node?

In my content page, i have got the valuepath of the right clicked node.

Or is there any other way than setting the properties in master page?

View 6 Replies

Web Forms :: Define Reusable Master Page Type To Reuse Parts Of The Master Page?

Jan 5, 2011

My Project is a normal web site, not a Web Project, and I am using VS 2005.

I am trying to define common Master Page Type in app_code which has an area to display error messages and the like. Very simple.

I added the following in app_code:

[Code]....

Also, I added the following in Master Page Source Declaration:

[Code]....

Also, I added the controls tblrowErrMsg and lblErrMsg as server controls to the Master Page.

Why I am doing this ?

This will allow me to display error messages from nearly any where inside the code in code-behined, app_code, and other core Class Projects (DLL).

View 4 Replies

Web Forms :: Object Reference Not Set To An Instance Of An Object Error When Remove Reference To Site Master Page

Sep 30, 2010

in my default.aspx page i have a dropdown List and a textbox with a submit button below that there are 2 listbox... and the dropdown list holds the names of the listbox

my logic here is to select an item from the dropdown list and put some text in the text box and submit the form which will add an item to the listbox selected.. but when i do this i get an error saying Object reference not set to an instance of an object. i tried to figure out the problem and found that when i remove the reference to the Site Master Page it works fine and when i undo and apply my reference back to the Site Master Page i get the same error.

[Code]....

View 2 Replies

Web Forms :: Master Pages - How To Access Content Page From Master Page

Sep 5, 2010

I have a master page setup that is used throughout my site that is basically a header with a menu. I recently added a textbox and a button to this master page which is to be a quick search box that is available anywhere in the site. When a user enters text into the search box and hits the button, I need to load the actual content page which is used to search and show search results (which also uses this same master page), and have the text entered available so the search can be triggered automatically. Again, this search text box and button is now in my master page so it could be triggered from anywhere in the app... it serves as a convenient way to do a basic search from anywhere in my app, without having to first navigate to the actual 'search page' that already exists. You can also navigate to the actual search page, which uses the same master page, where there is many more search options.I'm thrown off by the master page arrangement, which I have not used until this project. What do I do?

View 4 Replies

How To Use Sharepoint Master Page In A Separate Application As Parent Master Page

Sep 29, 2010

Is it possible to inherit a sharepoint master page(as a parent) in another application's master page which will be treated as child (i.e. after integrating that standalone application with the sharepoint application)? I am totally new to Sharepoint..

View 2 Replies

C# - Accessing Top Master Page Properties In A Nested Master Page Code Behind?

Feb 18, 2010

I have a nested master page that has its own master page. The parent master page has a property defined in its code behind.

Public ReadOnly Property SelectedPage() As String
Get
Return _selectedPage
End Get
End Property

How can I reference the parent master page's property from within either the child master page's code behind Page_Load or aspx template page?

View 3 Replies

Web Forms :: Get Nested Master Page From Main Master Page

May 30, 2010

I'm trying to dynamically change the look of my main master page depending on what nested master page that the current content page is using .

So for example.

Main master page = main.master
My nested page = nested.master (uses main.master)
content page = content.aspx (uses nested.master)

So in the Page_Load event of main.master I want to add a switch statement that will check to see what nested master page is currently being used by content.aspx, or whatever content page is loaded.

So far I have got

protected void Page_Load(object sender, EventArgs e)
{
string nMaster = //This is the line of code that I am looking for.
switch(master)
{
case "nested.master":
//all my logic here.
break;
}
}

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved