Part 28 Customizing the autogenerated edit view

  Рет қаралды 129,779

kudvenkat

kudvenkat

Күн бұрын

Пікірлер: 40
@azizyokubjonov7322
@azizyokubjonov7322 8 жыл бұрын
I believe at 9:06 just removing [Bind] would be much better. Because in this scenario, we don't even use Name while saving changes. If we did that, we wouldn't be removing the [Required] attribute and editing the Create action.
@Csharp-video-tutorialsBlogspot
@Csharp-video-tutorialsBlogspot 11 жыл бұрын
Hi Harika, we will discuss this in our upcoming videos on validation.
@naibedyakar
@naibedyakar 8 жыл бұрын
Appreciate your efforts Venkat. Awesome job. Very helpful.
@Csharp-video-tutorialsBlogspot
@Csharp-video-tutorialsBlogspot 8 жыл бұрын
+naibedya kar Thank you for the valuable feedback. Free Dot Net & SQL Server training videos for aspiring web developers kzbin.infoplaylists?view=1&sort=dd Download our high quality videos and slides for offline viewing www.pragimtech.com/Order.aspx Code Samples, Text Version of the videos & Slides on my blog csharp-video-tutorials.blogspot.com Tips to use our channel kzbin.info/www/bejne/r2ibYYCtnb5qZtU To receive emails, when new videos are uploaded, please subscribe to our channel using the link below kzbin.info If you like our videos, please click the THUMBS UP button below the video Thanks for sharing the link with your friends who you think would also benefit from them Sharing is fun Thanks Venkat
@dragony117
@dragony117 5 жыл бұрын
You are Just Amazing how I Ask my self A question And see you answering right away in the video Great Work
@avinashmamidi
@avinashmamidi 10 жыл бұрын
Hello SIr, In this video you had removed the required attribute on Name but if we do that on real time it is accepting null value for Name while creating a new Employee . Could you please advise on this ?
@AdvikaSamantaray
@AdvikaSamantaray 6 жыл бұрын
He mentioned adding the validation adding dynamically.
@liedebunker1253
@liedebunker1253 5 жыл бұрын
Hey, I admire you for having made so many videos. I went to your main page on KZbin, and I saw countess video clips. Wow!
@ammmaj
@ammmaj 11 жыл бұрын
Dear Sir It would be great if you could dive in details in the coming tutorials into building and customising dynamic data web sites. it is a very powerful method of accessing and displaying databases easily, and it would really make things easier for me to understand thanks to your great way of explaining things. Best of regards
@AbbasBengali
@AbbasBengali 8 жыл бұрын
Sir, You used Hidden field previously, then why didn't it help make do with the required field issue? Why did you have to remove the required field attribute?
@sudhanshu1709
@sudhanshu1709 8 жыл бұрын
Required attribute from public class EmployeeMetaData has been revoked for edit operation, so how it will remain Mandatory for Create operation?
@OrcaRiderTV
@OrcaRiderTV 3 жыл бұрын
How about having multiple Employee interfaces which dictate different requirements ? Employee : IEmployeeEdit, IEmployeeAdd wherease Name is required in IEmployeeAdd and not present in IEmployeeEdit Edit action will accept IEmployeeEdit and Create action will accept IEmployeeAdd
@nostalgian4113
@nostalgian4113 6 жыл бұрын
asyncing controllers fixes this problem, i had no need to use bind model, fiddler couldn't interfere because of this line in the controller in the if condition await db.SaveChangesAsync(); and I didn't have to delete the [required] attribute too.
@olliebutler3168
@olliebutler3168 6 жыл бұрын
How does that prevent unwanted changes?
@ramilhuseynov2891
@ramilhuseynov2891 6 жыл бұрын
if you remove [Bind(Exclude="Name")], you don't need to remove [Required] and it works the same as employee receives name, but you use previous name to save
@Csharp-video-tutorialsBlogspot
@Csharp-video-tutorialsBlogspot 6 жыл бұрын
Hi Ramil - Please watch the next video and in that we discussed how to fix this issue. Hope this helps. Here is the link to the playlist. kzbin.info/aero/PL6n9fhu94yhVm6S8I2xd6nYz2ZORd7X2v
@rishikmani
@rishikmani 8 жыл бұрын
How all the department names got loaded in the Edit page dropdown?
@rdg515
@rdg515 10 жыл бұрын
Could someone explain why it is not possible to simply assign employee.Name with the value from employeeFromDB.Name, and keep the employee object in the ChangeObjectState method? I tried it and it doesn't work, but I'm curious as to why.
@nanda3281
@nanda3281 11 жыл бұрын
hellow sir , it does not work with ObjectStateManager in visual studio 2012 so how can we solve this problem.
@dayanandthombare123
@dayanandthombare123 11 жыл бұрын
Hello Sir, It's OK to retrieve the data from db when we want to edit because we are showing that particular data while editing.but what is need of retrieving the data from DB on the POST request of edit..?
@harikaaakutota7776
@harikaaakutota7776 11 жыл бұрын
hi venkat, font color of error message is still in black color.how to change it and how to preceed * before error message.thanks in advance
@ranyil
@ranyil 10 жыл бұрын
After watching this video I am still asking myself why you do not add checking Gender field's value on submit here? For example: if (!new string []{"Male", "Female"}.Contains(employee.Gender)) { ModelState.AddModelError("Gender", "The Gender field is required"); }
@ranyil
@ranyil 10 жыл бұрын
Just forgot to add to use this needs using System.Linq.
@islvatansever3394
@islvatansever3394 8 жыл бұрын
Some people may not want to specify their gender. That's the only reason.
@codingtech2737
@codingtech2737 11 жыл бұрын
you can also get rid of html.validatefor in the view fro name property, and it will work fine, but if you will get rid of required attribute, it will cause null names inserted when you use create new view............
@naveenchawla70
@naveenchawla70 7 жыл бұрын
After Changing In Edit Controller when i m going run it i face a issue "Sequence contains more than one element " so now how can i resolve this issue ? sir please
@tutorialfair1985
@tutorialfair1985 8 жыл бұрын
How to handle Remote Attributes on when i edit or update
@sachin5j
@sachin5j 9 жыл бұрын
how gender DD is retaining the value in Edit page?
@user-wc3tz3be1j
@user-wc3tz3be1j 9 жыл бұрын
We got one more problem. let's say every employee is able to edit their info if they're logged in. then a malicious employee could pass some other employee's id through fiddler, .. booom!. Just changed someone's info . it happens of course without bind attribute. How we could handle this ? Venkat
@munkhn73
@munkhn73 9 жыл бұрын
why not just add readonly attribute to html helper for name? like . if you remove [required] from model then you can send create(post) request with name=null which can be verified on client side.
@munkhn73
@munkhn73 9 жыл бұрын
Munkh-Erdene Nasan what you are doing with the name is basically like 'ok A is 1. then second later. my whole life was a lie. the A was 0.'
@munkhn73
@munkhn73 9 жыл бұрын
Munkh-Erdene Nasan ok. my bad for commented without watching the whole video. but still all of that problems could be fixed just by adding readonly attribute...
@bilalyousuf6814
@bilalyousuf6814 8 жыл бұрын
we can still edit EmployeeId using fiddler which gives error.....
@codingtech2737
@codingtech2737 11 жыл бұрын
after getting rid of html.validate helper, simply assign name property from database object to incoming employee object, and you don,t have to change anything else.
@plflores33011
@plflores33011 10 жыл бұрын
can you please upload a tutorial in inserting an image to the database and displaying it to a table using entity framework?..
@nys8260
@nys8260 3 жыл бұрын
instead, we can use ModelState.Remove("Name") in edit action
@vatansoni6439
@vatansoni6439 9 жыл бұрын
Please clear my doubt sir, Why can not we use below approach for Edit, It gives error System.Data.OptimisticConcurrencyException was unhandled by user code {"Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries."} Code: [HttpPost] [ValidateAntiForgeryToken] public ActionResult Edit([Bind (Exclude="Name")]Employee employee) { Employee employee1 = new Employee(); employee1.Name = db.Employees.Single(x => x.employeeID == employee.employeeID).Name ; if (ModelState.IsValid) { db.Employees.Attach(employee1); db.ObjectStateManager.ChangeObjectState(employee1, System.Data.EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.DepartmentID = new SelectList(db.Departments, "ID", "Name", employee1.DepartmentID); return View(employee1); }
@user-wc3tz3be1j
@user-wc3tz3be1j 9 жыл бұрын
Hi, if we remove the required attribute, the client side validation will be gone too. Guess we have no choice to achieve this except writing a client side validation for this Name field.
@arun9385
@arun9385 9 жыл бұрын
You need to make a video on Register form which contain several Casacding ddl and on login form
@DineshGupta-xu1rd
@DineshGupta-xu1rd 2 жыл бұрын
Appreciate your efforts Venkat. Awesome job. Very helpful.
Part 29   Using data transfer object as the model in mvc
6:42
kudvenkat
Рет қаралды 170 М.
Part 12  Creating a view to insert data using mvc
10:40
kudvenkat
Рет қаралды 458 М.
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
Part 26  Customizing the autogenerated index view
8:09
kudvenkat
Рет қаралды 183 М.
Part 20  Preventing unintended updates in mvc
10:09
kudvenkat
Рет қаралды 174 М.
Part 33   Html helpers in mvc
11:04
kudvenkat
Рет қаралды 192 М.
Part 27   Customizing the autogenerated create view
7:58
kudvenkat
Рет қаралды 141 М.
Part 11  Using business objects as model in mvc
16:21
kudvenkat
Рет қаралды 468 М.
Part 30   View engines in asp net mvc
7:35
kudvenkat
Рет қаралды 146 М.
Part 18  Updating data in mvc
8:34
kudvenkat
Рет қаралды 227 М.
Part 19  Unintended updates in mvc
8:22
kudvenkat
Рет қаралды 184 М.
Part 15  Updatemodel function in mvc
8:24
kudvenkat
Рет қаралды 270 М.
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН