MVC :: NerdDinner Sample - How Does Delete Work - How To Control Deletes
Jun 7, 2010
I am still at the elementary stages of Linq To Sql and Entities usage. I started practicing MVC developement by following the NerdDinner tutorial here at asp.net, and I back myself up with fully developed NerdDinner sample (1.0 -- still on VS2008). I am also at the first half of the NerdDinner tutorial (I think -- maybe I'm further along) - so far I have gotten up to the Delete View. In the fully developed sample I noted that it uses ascx file (which I guess I will find out if the tutorial also will use
ascx files down the road). My sample app, which I am developing from the tutorial, seems to work OK so far. My issue is that I am not clear how the Delete mechanism works. In the DinnerRepository.cs I have this code (from the tutorial):
It looks like a dinner object is being passed to these mechanisms and the delete occurs based on a row ID value. But what if I wanted to delete multiple rows - say where ID between 15 and 20 - how to go about this? I was looking for a Delete statement but am not finding it either in what I have developed so far from my tutorial sample or from the fully developed sample. How can I control Deletes in MVC?
DbClick the code behind file of NerdDiner.edmx,It reads "This code was generated from a template." on the top comment lines. I generate my own .edmx file automatically with VS2010, just found that the .designer.cs file didnt contains Objectset,Methods as nerddinner does IDK which template hanselman used to generate this .edmx filesïždont tell me he wrote it all by himself! Shoud .edmx and its code behind file be generated automaticlly without hard-coding?
The delete link on my gridview deletes the previous row instead of selected row....Also, it doesnot delete the already existing rows. When I add new rows and try to delete them then my delete works that too incorrectly.
Lot of times I did edit, delete, insert in my webproject in different pages but I am very surprised that why I am not remembering the technique to do these task. Actualy I never take any course on asp.net/vb.net, what I did in my project just to take help from forum or asp.net website etc. I get a task again to make a web interface having functionality to view data and provide Edit functionality also. The other task is to click a link in the same page to open a new page with the fields of the same table to insert new record.
Q1: Is it necessary to take a dataset or I simply do it using sqlDatasource?
Q2: Could anyone give me a very basic and simple vb.net/asp.net project with all above tasks so that I will do a practice project and never miss it?
I have a Gridview (VS2008 3.5) which has a Edit Button and a Delete button.he Delete button deletes the row without confirming deletion with the user first. ow can I use the Confirm/Delete Confirm from Ajax Toolkitif possible and if not, is there a way to Confirm/Delete with user firstwhen using Gridview?
I am trying to work through a sample of exporting a gridview to an excel spreadsheet.I found the code below on the internet. I pasted it into a test.aspx page. I need to establish a connection to the NorthWind Database. Or if you have a better example of exporting a gridview to excel, share. Here is the location of the northwind.mdb on my pc: (and is this sample looking for an access database or a sql database...what is the filetype of a sqlserver database?) See code below
c:Program FilesMicrosoft Visual Studio 8SDKv2.0QuickStartaspnetsamplesdataapp_data orthwind.mdb
I am trying to get the modalPopup to work. Don't get any errors, the panel popsup as is supposed to, but the background doesn't gray out and the background of the panel doesn't display correctly either (it is black). The background of the main page doesn't change. To make sure I wasn't doing something wrong, I downloaded the samplcode (vb) from the AJAX website, and created a completely new web page, css file, .vb file, etc. Still have the same issue. I am using the latest version of ajaxcontroltookit ( 4.1.40412.0), VS 2010 RC, and VB)
How do I remove the error message below in order to view the HoverMenu sample found in the ASP.Net Ajax Control ToolKit?Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.Source Error:
i have a web-site which uses forms based authentication. thus i have a login page with a login control on it. how would i go about coding the authenticate event of this control to talk to the Entity Framework to validate the user credentials?
I moved a site to another server, it worked fine for a a while, but then crashed. I figured out that System.Web.Extensions.dll was missing, so I copied it again. After a while it was missing again. Using Process Monitor I figured out that IIS (w3wp.exe) deletes the file soon after I copy it to the bin folder. (CreateFile with "Read Attributes, Delete" access.)
I have a gridview connected to my objectdatasource, i wrote a class for the database queries.Now when i do an update of record i get the id form the grid, when i click on delete i don't get the id, its 0.Is there an option to set the id? i can't find it in the gridview.
I have uploaded the nerddinner sample to "www.aaa.com/test/nerd". When a mouse is on menu tab such as "Find a host" then the link is shown at the bottom of Internet explorer as "www.aaa.com/test/nerd/Dinner" with the contoller name "Dinner". When the mouse is on the main logo which is on top and left, the link shown as "www.aaa.com". So it direct me to "www.aaa.com" instead of "www.aaa.com/test/nerd"
When can I change it? I have tried change the "start url" from the application property, but it did not work.
As I am working thru the NerdDinner MVC example. I found that after implementing step 6 that edits to a dinner were no longer saved. After some investigation I found that I needed to add the ValueProvider to the UpdateModel function call in Edit (HttpPost) example. My updated code is below.
I am trying to delete three related objects on one submit. Delete fails on one of the child objects, because of foreign key contraint with another table, It deletes one (the parent) but not the two child objects. All in one SubmitChanges(). I even used the TransactionScope, still same thing. So here is the scenario:
I have an object called Page which has a collection of objects called Webinars. There is another object Called Product which is one to one with Webinar.
I need a Listview that will show info from several database tables. My delete button, will not delete the record from the database. I cannot get DeleteOnSubmit() to work at all. I am in the very beginner stage. This is my first project. I thought this would be a good project for learning purposes.
I have problem when I am working on the NerdDinner tutorial. If I create local database (in the project local) then it is working OK, but if I added connection with the database already existed in the SQL EXPRESS 2005 (using Data Connections -> Add Connection; from the Server Explored in the VS 2008) then I got GPF. Does anyone know how to use the database for server instead of local project?
I started a website based on the NerdDinner source code, everything worked fine (more or less) but whenever I post an event, it ends up on the exact same coordinates on the map regardless of the address (Somewhere in the Gulf of Guinea!)
No idea what to do: I didn't alter the map code at all!