Can Add Different ActionResults For The Same Page

Mar 23, 2011

I've researched this before asking, but all I can find is trivial apps that all use the same type of example. My first, of many, questions involves Controllers->Views.

Of all of the examples I have seen they always return one view. For example, the Home/Index control will return a view like so: return View(model); But, what if you need multiple views for the same page? Say you have to return two pieces of data, for other parts of the page, would you need to add all control logic in the single Index Controller View(), or can I add different ActionResults for the same page?

View 18 Replies


Similar Messages:

Responding To ActionResults With JQuery?

Jan 3, 2011

I know how to respond to a form post in ASP.NET MVC using jQuery, but I'm having trouble with something that is a little bit more simple.

The scenario is that there is a list of items on the screen, like an ordered list.

<ul>
<li>Item 1</li> // each will corrospond with an id.
<li>Item 2</li>

This is a crude example, of course, but the basic jist is that when the user clicks one, it will perform some server side logic... so in the controller, there is a method such as ..

public bool CheckSomething(int id)
{
// do some logic to determine if the result should be true
return true;
}

It's very simple logic, really - but it still requires database access, so I cannot do it in javascript. I need to have it hit my controller. The problem is that I want the UI to respond to this. how to exactly wire this up without using a Form.

View 2 Replies

Images Via IIS Or Controller ActionResults?

Nov 5, 2010

I have an ASP.NET MVC2 application that is maintaining a library of about 10GB of images. Many of these are customized by the application. We had been storing these in SQL but for a number of reasons, we are moving our images to the file system.

The file system vs SQL issue aside, should I be serving up my images through ActionResults on Controllers or directly serving them up via IIS and a separate web site? The former offers a number of advantages such as control over caching and some dynamic redirection but I would assume directly accessing files via IIS will be more efficient. How big an efficiency hit will I take serving up the images myself?

View 3 Replies

MVC :: 2 ActionResults Both Doing Seperate Things?

May 20, 2010

I have 2 ActionResults both called Create which basically create different things on a model. Is there a way to have overridden action results? - I dont quite follow routing and not sure how to do what I'm trying to do.When creating A i call :-

AcceptVerbs(HttpVerbs.Post)]
public
ActionResult Create(ProjectModel

[code]...

View 1 Replies

Having Common Page Title In Master Page With Each Page Adding Page

Aug 26, 2010

My master page looks like:

<head runat="server">
<title>
<asp:ContentPlaceHolder ID="PageTitlePlaceHolder" runat="server" />
</title>

Content pages look like:

<asp:Content ID="TitleContent1"
ContentPlaceHolderID="PageTitlePlaceHolder" runat="Server">
My Page
</asp:Content>

This works by placing the content page specific title on the page ("My Page" in this example). Now I want to add a global prefix to the title in my master page for the site name. So I want:

<head runat="server">
<title>
Example.com:
<asp:ContentPlaceHolder ID="PageTitlePlaceHolder" runat="server" />
</title>

However, when I do this content pages are still rendered without "Example.com" in the tile, it's like it's ignored.

Why is this happening and how can I achieve this?

View 2 Replies

Page Life Cycle Sequence Between Master Page And Child Page And User Control?

Jun 4, 2010

I want to share a common page load and page init events sequence between Master page and child page and User Control as described below:

Let us have the following components:-

1. TestMaster.master -> It is the master page

2. TestChild.aspx -> It is the Child page

3. TestUserContrl.ascx -> It is the UserControl present within the TestMaster.master page.
[code]...

View 6 Replies

Web Forms :: Accessing Master Page's Body Tag From Aspx Page That Is Not A Content Page

Jan 8, 2011

I am using Master page and Content page combination.But how can i access <body> tag and it's event (onload, onunload) of Master page in .aspx page that is not a content page.

View 12 Replies

Web Forms :: To Get A Normal Html Page Inside The Master Page Instead Of Content Page?

Mar 25, 2010

I have a master page homeMaster.aspx and many content pages. However the situation is I have few .html pages. Now when a user clicks on a link the html page should get loaded.inside the master page. The problem is these are .html and not content page with .aspx.

View 4 Replies

Web Forms :: Treeview Style Doesn't Apply In The Page If That Page Is Using Mater Page

Jun 10, 2010

I've encountered a problem when I put a treeview in a page which is using master page. The treeview style doesn't apply.For example, I set the nodes with different colors in different levels. But the treeview nodes are still displayed in the default color(bule).

The treeview code is :

[Code]....

If I use these code in a page which doesn't use a master page. The nodes are shown in colors.

View 3 Replies

Restricting Certain Pages -- Redirect On Every Page? Or On Master Page By Viewing Current Page In Url?

Feb 6, 2011

Per different user mode, some pages should not be accessible by users unless they have a valid session key.In your opinions -- would it be better to have a list of acceptable pages in the master page, and check if the current page is valid for the current user? Or handle this on every child page?I'm thinking master page, just want to hear what your input would be.

View 2 Replies

Javascript - How To Pass Page Or Master Page Object To AJAX Page Method

Oct 5, 2010

I wrote a page Page method in my aspx page. in web service method I need to call FindControl method return textbox and get text box value. But my findControl will take MasterPage object to iterate.

code.<script type = "text/javascript">
function ShowCurrentDateTime() {
$.ajax({ [code]....

But I am getting compiler error when use Page.Master: Reference to non-shared member requires an object reference

How to pass Master Page object or Page to Page method?. So I can use in Sared method.Is there any way I can access Textbox value directly in Page method? I need access couple of controls in Page Method.

View 4 Replies

How To Run The Javascript Function On The Page Onload Event In Content Page Of Master Page

Nov 4, 2010

HOW TO RUN THE JAVASCRIPT FUNCTION ON PAGE ONLOAD EVENT IN CONTENT PAGE OF MASTER PAGE.?

means i have masterpage and the content page of master page namely default.aspx in vb.net

My problem was that .

i wanna run javascript function in Default.aspx and i have called the function

body onload in master page..

when i run my website it shows the error

"" Microsoft JScript Runtime Error : Object Expected ""

View 4 Replies

Page - Dont Want Full Page Refresh When Click A Button In A Web Page?

Feb 18, 2010

How can I use double buffering in asp.net C#?I want smthng like that : I dont want full page refresh when I click a button in a web page.. I think it can be solved with double buffering. When a button clicked for redirect a content page (button-in master page), current page will not go until the redirected page completely load in the background..

View 3 Replies

Query The Page For The Table So That The ASP Page Returns A Valid Page On Request?

Jun 17, 2010

I am wondering if there is anyway to grab the html that is generated from an ASP page.I am trying to pull a table from the page,and I foolishly used a static html page so I would not have to be constantly querying the server where this page resides while I tested out my code.The javascript code I wrote to grab to unlabeled table from the page works.Then when I put it into practice with the real page and found that the ASP page does not generate a viewable page with a jquery .get request on the URL.

Is there any way to query the page for the table I need so that the ASP page returns a valid page on request?(I am also limited to using javascript and perl for this,the server where this will reside will not run php and I have no desire to learn ASP.NET to solve this by adding to the issue of proprietary software)

View 2 Replies

Does The Page Handler Execute First Or The Actual Page Resource Like Some Page

Feb 13, 2011

I am a bit confused about these two sequence of events or processes happening in conjunction to each other. Does the page handler executes first or does the somepage.aspx get execute first or do they happen simultaneously?

View 2 Replies

How To Work With Master Page That Is Attached To The Page Via The Page's Basepage

Nov 2, 2010

In my ASP.Net web application, I have a base page that implements functionality that spans all pages of the web application and my web pages derive from this base page. Since there is a single master page for the entire website, I don't want to attach the master page in each of the web pages. So I attached the Master page via the basepage's OnPreInit method as follows:

protected override void OnPreInit(EventArgs e)
{
this.MasterPageFile = "~/Site.master";
base.OnPreInit(e);
}

However, when I switch to Designer view, I get the "Master Page Error"; The page has controls that require a Master Page reference, but noe is specified. Correct the problem in Code View.When I run the application, the webpage shows up correctly.What should be done so that the designer shows up correctly without having to go and set the master page explicitly in each of the web pages?

BTW, I am on Visual Studio 2010 and .Net 4.0

View 1 Replies

Explain Page Life Cycle When Page Contains Master Page

Nov 3, 2010

Explain page life cycle when page contains master page

View 1 Replies

Javascript - If Users Press The Browser's Back Button To Reach The Prior Page Then Page Should Display A Message Like "web Page Expired"

Jul 23, 2010

if users press the browser's back button to reach the prior page..then page should display a message like "web page expired" in asp.net can i use javascript for this?

for example..

there are 4 pages in web sites. 1,2 and 3 can be back. but when the 4th page run then 4th page can not be back... when the user press browser's back button , diaplay ma message "weg page expired".

View 4 Replies

How To Share Session Between Page In Page To Page Request

Aug 19, 2010

My application is simple, I have 2 pages:

RSSProducer.aspx: A page that generates RSS (XML) feeds
RssConsumer.aspx: A page that retrieves the RSS feeds and displays it to the user in a repeater control. To do this I am using the System.Xml.XmlTextReader to fill a DataSet with tables based on the RSS-XML retrieved from the RSSProducePage. A table within the DataSet is bound to the repeater control.

For example, this is what I have in my RssConsumer.aspx page:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Session("permittedToViewSomeDetail") = True
Dim url = "http://localhost/DevSite/RSSProducer.aspx"
Dim reader As New System.Xml.XmlTextReader(url)
Dim ds As New DataSet()
ds.ReadXml(reader)
myRssRepeater.DataSource = ds.Tables(2)
myRssRepeater.DataBind()
End Sub

My problem is that user-authorization details are stored in Session in the RssConsumer page that need to be accessed in the RSSProducer page (in this example it would be Session("permittedToViewSomeDetail") that I need to access in the RSSProducer page); however, the Session identifier is not common between the two. This means that I cannot access the authorization details in the RSSProducer page.

The reason for why is fairly clear to me:

User's browser makes a request to the RssConsumer page Server generates a Session ID (which is stored in a cookie) if there is no existing Session Identifer The RSSConsumer requests the RSSProducer page...which generates a new Session ID every time because no session identifier is ever going to be found.

I tried using cookieless session so that I could pass the SessionID via the URL to the RSSProducer page as an experiment but for some reason the XmlTextReader doesn't work well with this method (but the desired shared session does work). I've hit a brick wall here. Does anyone know how to share session between pages when one page makes a request to the other?

View 1 Replies

AJAX :: Using Go Next Page And Previouse Page Without Reload Page?

Jan 15, 2011

i have two page in asp.net and one page is a main page(Page 1) that have button Next. when i click the Next button it's will go to the Next page(Page 2) but i don't want the page reload. i try to use the Script Manager, UpdatePannel but it still reload page.

View 2 Replies

Web Forms :: Redirect Parent Page To Error Page If Error Occurs In IFRAME Child Page

May 7, 2015

I have a data driven asp.net website with frames on the top, left, right and center screen.  If a page generates an error on any of the frames, I want to redirect the whole site back to the Default.aspx.  Currently, when a frame page errors in one of the frames, that frame gets the error pages.  Site is URL....  Is this something that can be handled?

View 1 Replies

Web Forms :: Hiding Repeater On Master Page From Content Page / Access From Content Page?

Oct 6, 2010

My project has the following repeater menu shown on the Master Page. I need this menu to remain hidden until the user logs in. How do I access from content page?

[Code]....

View 2 Replies

MVC :: Error In Subview Master Page Not Show The Custom Error Page On Entire Page ?

Oct 28, 2010

I am showing Custom Error in my page.if somehting happend wrong. but if the same error occured in my subview master page I am not able to show the Custom error page on Entire page its showing me that Error page under subview master page.I am attching the Screen shot.Can any body help me out how to show the Error page on entire page if something happend in any where submaster or other page.Here is the code that I am using in web config file to show custom Error page..

[CODE]...

Here I know the issue what's going on.This issue is occurring because i am using AJAX to partially load the contents of the tabs after the initial page load so the error is occurring AFTER my master page has been loaded.What I need to do is provide a javascript function to handle the error after the ajax call has returned and redirect to the error page.How to write this Javascript and where Do I need to write this?

View 4 Replies

Web Forms :: How To Write Aspx Page HTML From Aspx.cs Page On Page Load

Dec 1, 2010

i want to write aspx page html from aspx.cs page on page load..

i hav already used div.innerHtml...

i want to write below code in aspx page from aspx.cs page

[code]....

View 5 Replies

Call Page Method Of One Page In Another Page

Mar 22, 2014

How can I call Code Behind Method from another page or handler?

View 1 Replies







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