Forms Data Controls :: Datalist And A Listview In A Master/Detail Relationship?
Jul 2, 2010
I am using a Datalist and a Listview in a Master/Detail relationship. Each time a DataList item is bound, a Listview is loaded dynamically. I have provided the relevant Layout and Item templates. It is worked fine for one item. But for more than one item, it will raise the following error: "An item placeholder must be specified on ListView 'ItemListView'. Specify an item placeholder by setting a control's ID property to "MyLayout$itemPlaceholder". The item placeholder control must also specify runat="server".
Despite having set up the item placeholder.
I made my own master-detail pages using a listview. Rather than url, I use a listview event to set a session variable and response.redirect to the detail page, which on Page Load, loads the data from the database using the session variable, where it can then be edited. The details page is basically just text boxes and dropdownlists, but I used some third party controls and it all looks really sharp.
Here is the corner I pained myself into. Several dependent dropdowns on the master page filter the main listview. If I go back to the master page using response.redirect, the user would have to use the dropdowns again just to get back to where they were before they went to the details page. This is just not going to work.
To further complicate things, I wanted the master page to have paging on it. So if a back button reloads the page, they would have to set the dropdowns again, and page through the data again if needed. Egads.
I have an "Edit" page that uses a FormView bound to an EntityDataSource. The page is called with the ID field of the record to edit in the query string: "EditEmployee.aspx?ID=10". The EDS the FormView is bound to is using: AutoGenerateWhereClause=true and a QueryStringParameter. Below the FormView I have a ListView that contains some child records of the FormView. The ListView is bound to a seperate EDS and also uses the (same) QueryStringParameter.
The problem I am having is when this ListView attempts to Insert or Edt a column I receive an error because I don't have the ID field (EmployeeID) of the parent bound anywhere in the ListView (and obviously, it is setup as a ForeignKey so it fails, like it should). Any advice on the best way to get this ID (EmployeeID) column bound in the ListView? There are many things I can do in code behind, but I would like to solve this in the markup if possible. I can move the ListView so that it is inside of the FormView if necessary.
I'm trying to setup is a News module with article listing paging and article detail paging. I have a GridView with paging that lists my articles just fine. In that list, some article titles have links that direct to an article detail page by passing in the articleID to the details page. I was able to setup my details page, which uses a DetailsView control, to use paging by using an ObjectDataSource with pageIndex and pageSize parameters from the querystring. Once on my detail page, I can use my navigation arrows to move through Next and Previous articles just fine.
No matter which article I click in my article list, my detail page always starts with pageIndex 0 and thus not the article I clicked on. I understand why that is because it's going by pageIndex value instead of articleID. What I need it to do is, set the detail to whatever articleID i pass in, then allow me to navigate Next and Previous to THAT particular article instead of starting me off from pageIndex 0.
I've been experimenting with using EF (asp.net 3.5 sp1) with a master detail page. Using northwind as the database, I'm simply trying to have categories as master and products as detail. I have read everything I could find on the net about the where condition and it still fails with this error as soon as I click the select link in the master grid:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: A property with name 'CategoryID' does not exist in metadata for entity type 'WebAppEF01.Products'.
What strikes me is that the CategoryID column is not exposed by the EF model. That's been rolled up into the navigation element 'Categories' I suppose...but on the surface this seems to create the problem I've running in to. I've tried turning off the autogeneratewhere clause but didn't have success. The code for this page follows below.
I've been wracking my brains for a while. I have a master record that I want to add children to. In a database it's a one to many relationship with a foreign key in the child table.
I have a formview that I want to use to fill in all the master record info, and choose the child info from a dropdownlist, and click an add button, and have the add button add the child info to some control on a page. Then when the user clicks insert, the formview has an ItemInserting EventHandler that will handle all the logic for inserting the master, grabbing its primary Key.
So, I know what to do, I'm just not sure of what control to use, or what memory object etc., that I want to store the child info in until the master record gets created.
I'm sure this has been done a million times, but for all my searching, I couldn't find anything to help me. Does anybody have some advice or can anybody point me to an internet resource where this has been hashed out?
I am using a GridView and a DetailsView to establish a master to detail form, the idea is to let user select a record on Gridview and Detailsview will load selected record for editing. Here is declaration for the ODS and Detailsview.
this is working fine when I select a record from GridView and edit/update it in DetailsView. But it's not working so well when I insert a new record using DetailsView, because after insertion the selected record remains as the record selected in GridView.
I have a gridview that displays some records....i have added a new column to it called Edit....now when i click the edit link it should take me to a new page where i can edit that particular record only.....how do i go about it? I am using forms and no inbuilt ASP.NET controls except gridview....so i need to write queries for the same.....plz post code if possible
Im making a Master details web page ASP.NET. I have one aspx page with all the items in a listview, then a link to another page to show the details view, but I dont want to use a asp:detailsview control becasue it generates a table, and I want a more complex layout. I want work each property of the item, but I dont know how. I want to do in LINQ. This is my very bad aprox: I need an orientation of how to get ONLY one item from the LinqDataSource on the page load and not to query the database everytime I need a column. I dont need biding because I only need to show data, not insert, not update, not delete...
I use Gridview along with Formview for master/detail viewing. When I change sorting in gridview selected index changes, too. I mean, eg first top record is still selected but it's another id. What I want is to keep id of selected record, in case of need changing a page
I have two tables. One table containing 1 master record and the other table containing multiple records per 1 master record. I want to only display in a gridview (or whatever is best) the master record AND its assocated detail records IF certain fields in the detail records are there. I have been trying to figure out how to do this but I am still a bit of a newbie and I don't how I can do this.
I am using the multiview which on one view has my gridivew and the other has my detailsview. My gridview is a template gridview and I have a button for edit and another for delete.What I want to do is when either the user clicks the edit or delete buttons that the appropriate record is selected and the multiview view is changed to the detailsview showing the selected record.My datasource is microsoft's object container datasource NOT the objectdatasource and I am using model view and controller design pattern in my coding.
article on binding to a list and I've got that working fine on one view. But what I'm stuck when doing it off a master record. Everything seems to work except that when I look in the database the detail records previous associated with the current master have their Foriegn key to master set to Null and a new set of detail records have been inserted. I've got a really simple form for this object
The form collection comes back with the expected prefixes:
And the Controller.UpdateModel(master) binds all the properties correctly. But when I call dbContext.SaveChanges it issues the follow sql from sql profiler (psuedo code)
I've got a work around that works but it's pretty hackish and I'm currently not matching up the keys so it's dependent on everything coming back in the right order. Plus I've got to include all the fields that I want updated.
I thought that entity framework's code first was the culprite but I've unit test that and it works fine. I've got a feeling that UpdateModel is somehow removing and re-adding the children. Has anyone else got this to work? Of course, I could throw in the towel and parse the indexed field names myself, but I'm so close!
design pattern that works well with Visual Studio data tools against an MS SQL server; to retrieve a subset of an object's fields for all rows, and then on-demand retrieve the remainder for one row. I.E. just the small summary fields that I will serialize to a master grid view, then the larger properties including a large blob that I will render in a detail view. The performance hit from retrieving the large blob with the master result list would be too great.
The data shape is static, and I can define two separate data classes to match the specific summary vs. detail information returned. However that sounds anti-pattern-ish, to define the data classes specifically to suit the presentation layer. It also presents another problem, how to translate from the summary item to the detail item in an object-oriented way?
I have a DataList control that I use to display a list of words.
When a user click on any of these words, I want to display the details of this word's in my ListView control that is on the right side of the DatatList control. The ListView control is setup to use a SQLDataSource control. I want to use the SqlDataSource1_Selecting method to grabe the ID from the DataList control but I'm not sure how I grabe the ID or how to setup the DataList to send the ID over.
I am extremely new to ASP and just started learning. I want to know which is better between Datalist, Gridview or Listview if I need paging and sorting functionality? This is what I have so far.
I've tried Datalist but I am having trouble with the paging portion. I've tried gridview and listview and got the paging to work but for some reason, when I click on Pg 2, it refreshes the search or something and what was shown on Pg 1 would appear again on Pg 2.
I have a Page with a FileUpload control on the top with the "Insert" button, in order to insert pictures Below that, i have a Listview showing all the pics. THis is the way i am placing my Update Panel:
How can i, press the INSERT button and reloads only the Content Template after INSERTING?