MVC :: Displaying Two Separate DB Objects On The Same Page?
Nov 2, 2010
What I would like to do using LINQ is display two seperate db objects on the same page using ASP.NET MVC. So I could have URLs like:
www.x.com/location1/item1
www.x.com/location1/item2
Displays the information for Location1 and items 1 or 2.
www.x.com/location2/item1
www.x.com/location2/item2
Displays the information for Location2 and items 1 or 2.
There is no difference between item1 and item2. So each location could be associated with each item.
View 1 Replies
Similar Messages:
Jan 13, 2010
I'm trying to achieve something very similar to a forum. Two basic tables in a database, [Thread] and [Comment] (one to many relationship).
I need to create a form using MVC that creates the initial Thread, and also the very first comment row in the [Comment] table, which references that topic.
Would I need to create a custom object for the View Model? Is there any examples anybody knows of that demonstrate what i'm trying to achieve as I can't seem to find information..
View 9 Replies
Oct 4, 2010
I have a web app using SQL2008 R2 and VS2008, the reports are deployed to the report server, and in the app we have aspx pages where the user can select report criteria to run the reports, and when they are done selecting the criteria they click on the run report button and the report will be displayed in a separate aspx page which contains the reportviewer control. I use Server.Transfer() to display the reportviewer page because I need to use session to store the report criteria that the user selected (can't use URL parameters because the criteria can be quite extensive), and we don't want to cause the parent aspx page to postback.
The above works fine currently, but what our clients don't like is that the report is opened in a full browser window (with all of the address bar, toolbar, favorites, etc.), they really want the report page to open in a window with none of those stuff. One of the complaints is that they often mistakenly click on the printer icon in the browser toolbar instead of the one in the reportviewer control. I know how to open a window using javascript (window.open) and set the properties for the new window, but then I wouldn't be able to use session to pass the reprot criteria. Using Server.Transfer() or Repsonse.Redirect() would not let me customize the browser window.
To summarize, here are my requirements:
1. the report must be displayed in a separate page
2. the report should be displayed in a barebone window (without the browser toolbars, etc.)
3. report criteria are too extensive to pass as URL parameters, I have to use session to store the criteria
4. I would like the parent page to not have to do a postback
View 3 Replies
May 19, 2010
I have a page where i enter the number of members i need to add now suppose i chose 3 so on next page i have get a display like member1 enter details(name, address, phone etc) just below that again member2 enter details(name, address, phone etc) and member3 enter details(name, address, phone etc)in short the no of forms displayed in a page depends on the no of member an user want to add and on submitting the data's of 3(no. provided by the user)member has to be inserted. As i am a rookie to asp.net its hard for me to imagine the logic and implementing them, what to do about tose textfied id's? how to generate the id's and how to separate the codes in .cs and .aspx etc
View 3 Replies
May 19, 2010
I'm building an MVC 2 RTM app, and I want to be able to share my model across applications. I'd *like* to be able to implement it like:ASP.NET MVC2 app (holds Views and Controllers)Class library to hold Model(s)WCF app to handle the data transactions with the models via different data stores across apps I had the MVC app working fine, but I wanted to abstract the data stuff and be able to work with the model across apps through the WCF site, so I created a class library project and moved all of the Models classes into that and set-up a WCF app, then added project references to the MVC and WCF apps that point at the class library. The idea was I can create services that take and return objects from the model via method calls across apps. It appears that everything's wired up correctly in the MVC project, so I'm passing the objects stored in the Models class library between controllers and views and everythig is compiling just fine, but for some reason the data is not being passed back from the views to the controller on POST -- all of the properties in the classes are null or empty.
When I debug the app, I can see that the values are stored in the model data dictionary but not the model object itself. What am I doing wrong? Am I on the wrong path, or missing something obvious (to some)?
View 2 Replies
Jan 14, 2010
I have access to two seperate databases (mySQL) located on two servers. I need to get the data, link the tables on a key field and display the results in a datagrid. My challenge is that if the search criteria changes for the display it affects rows returned from on table and should thus automatically affect the linked table and resulting data returned.
what the best approach would be to achieving this? So far I have set up a dataset with a dataadapter and table for each connection and then linked the tables in the dataset. The problem that I'm having is getting the linked resultsets to work.
On my form I have the datagrid with two Objectdatasources one for each dataadapter and i believe that's where I'm going wrong...
View 1 Replies
Sep 29, 2010
In parent page there is an imagebutton. What I want to when user click this image button, another page will open with width=200 and height=100 with no toolbar.
View 11 Replies
Mar 27, 2011
i am using mvc3 and razor view engine,
when i request login page, the page views in master page. i do not want to this. because i am making an admin page so the page must be free from master page.
i will design a new page for login that included username and password inputs.
aspx view engine includes Page Inherits="System.Web.Mvc.ViewPage but razor view does not include
View 1 Replies
Nov 17, 2010
have some Objects, lets say Employee and Role defined as below and I have defined relationships in my database that gives me a list of objects say employees and thanks to my framework each employee object also has a Role object linked via the RoleIDID, UserName, Password, Email, RoleIDRoleID, RoleNameSo in code I can do something like this
Employee emp = dataService_GetEmployeeByID(1);
string RoleName = emp.Role.RoleName;
Now here is my problemI can bind any object in a repeater and it works fine for the first level in my relationship
For instance <%# Eval("UserName") %>
But I need to be able to show the details for my child objects as well (Role) so something like this (which does not work)
<%# Eval("Role.RoleName") %>
View 2 Replies
Apr 6, 2010
I know how to bind a simple objects to a dropdown list. However I am having problems binding my objects which contains sub objects to the control.i.e. with simple object i just do ddl.DataValueField = "myproperty"
with my objects they contains sub objects which i want to bind. I have tried ddl.DataValueField = "sub-object.myproperty" which doesnt work.
View 2 Replies
Jun 21, 2010
firstly a static class only ever exists once and is not an instance. Any static members (ie static int NoOfPeople;) is stored in one place and is shared between all sessions (like the old global variables).
Now static methods is where i'm not 100% sure. If I have a static method that doesn't use any other static members could this cause inconstant results, example (this is a fairly pointless method but just a quick example of the top of my head)
[Code]....
So in this example if two sessions (or threads) were to call this at the same time - would they both get back the expected results, because the method only uses private data (a, b and totalToReturn).Im sure this sounds a little simple but I will be using static methods to build user objects and various other objects that there will have to be a 100% garentee that the objects will not get mixed up between sessions and the wrong things return to the user.
View 5 Replies
Feb 2, 2010
I am beginner to ASP.NET MVC.
We are doing project in Asp.Net MVC and Nhibernate.
How to seperate my project in to layers ? how to design classes ?
should i followany patterns ? repository patterns ?
View 3 Replies
Jun 11, 2010
I have a view where I want to perform different actions on the items in each row in a table, similar to this (in, say, ~/Views/Thing/Manage.aspx):
[code]....
In the most part, this is working fine. The problem is that if ThingService.SetEnabled throws an error, I want to be able to display the error at the top of the table. I've tried a few things with Html.ValidationSummary() in the page but I can't get it to work.
Note that I don't want to send the user to a separate page to do this, and I'm trying to do it without using any javascript.
[code]....
View 2 Replies
Apr 19, 2010
I design web site by asp.net my website contain news page ,advertisement page and others ,I design Separate page for news and advertisement so I have question what is the best when I design Separate page or place news,advertisment and other page in multiview (view)
View 4 Replies
Aug 6, 2010
I'm wondering how I can go about accessing page controls from a separate class I've made. I've tried a few things I found using google, but no luck :(
What I'm trying to do is keep a function that is used often, in a global class.
The function then accesses a page literal and calls ScriptManager.RegisterStartupScript. I was hoping this is possible, so then this function wouldn't have to be copied to all of the pages.
View 4 Replies
Nov 3, 2011
using a asp.net xml menu...need to have the page open in a separate window but the target attribute isn't working
Code:
<SubMenu text="About4" url="About4.aspx" target="_blank">
View 4 Replies
Feb 24, 2010
I've got a page that I'm using as an e-mail template. I'd like to spin off a new thread, take the rendered page, and put it into an e-mail. Is this possible? If so, how? I haven't had luck so far.
View 3 Replies
Aug 19, 2010
I have a 2D array of doubles in my Default class on my Default.aspx.cs page, like so:
protected Double[,] time;
By the time the page loads, I have populated this array from a database. Now, I want to reference this array in another file (Diff.aspx.cs) to avoid visiting the database again. Also, the data is used in a read-only fashion.
View 2 Replies
Dec 18, 2010
I alway have a case where I have one .js file which contain event handlers for many pages in my website, something like this:
$(function () {
$('#my-textbox1').click(function(){ doSomthing(); }) //--> this my-textbox1 exists in page example1.aspx
$('#my-textbox2').click(function(){ doSomthing(); }) //--> this my-textbox2 exists in page example2.aspx
});
Now suppose the user opened page example1.aspx, jquery will search for my-textbox1 and if found it will attach a click event to it, then will search for my-textbox2 and will not find it and will not attach the event.
But like this jquery in all cases will search for my-textbox2 in all pages,
What I want to know is the best practice you do to avoid unwanted selectors to get called in pages that don't want them.
May be it is not a big problem with 2 events, but suppose i have hundreds of events want to attach, this will affect the page load performance for sure.
View 3 Replies
Jan 15, 2014
in my webform --
when user input the valid data then there will be generate a areport and that report displays in a gridview itemtemplate. when i print the report, only first page data printed properly on a predesigned designed paper. and others are not. then how to print each rowdata of gridview on per page.
View 1 Replies
Apr 21, 2010
ASP.Net Page layout is not displaying properly in QA machine but is displaying correctly in Dev Machine. What could be the issue? We are using ASP.Net 2.0
View 1 Replies
Feb 5, 2010
I am using the followign object in my asp.net page
private static Dictionary<string, List<Guid>> OpenNodes = new Dictionary<string, List<Guid>>();
//Page start
if(!OpenNodes.ContainsKey(Session.SessionID))
[code]...
View 3 Replies
Oct 1, 2010
when my session timed out than
error page is
[URL]
how to open Login page in Separate window
View 2 Replies
Nov 8, 2010
I have a separate aspx Page called Home.aspx page and a separate class called class1.cs
I want to attach the class1 into Home.aspx
I try with this but not work
[Code]....
View 5 Replies
Dec 10, 2010
I'm generating a number of calculated arrays in the code behind a ButtonClick event on a particular page. Stuff like:
Dim Delta(,) As Double = New Double(nPer - 1, 0) {}
For i = 0 To nPer - 1
Delta(i, 0) = Delta_Buckets(i, 0) + fwds(i, 0)
Next
What I want to do is convert this to a datatable and use this as a datasource for a gridview in a different page.
View 2 Replies