Missing Insert functionality in GridView – Part 1

by rahul 7/6/2009 4:52:28 AM

I have never been a very big fan of “drag and drop, do data binding… get your application up in no time, and rejoice” approach, but sometimes when I am really lazy I go that route too. So, today was that day…

I had a very simple requirement. Let’s take a look at the two tables below… one is Course (Master) and the other one is CourseArticle (Detail). My requirement is to use LINQ and see how fast I can make the things work in ASP.NET.

image

Approach 1 : Using GridView

Step 1. Drag and drop GridView –> Select New Data Source

image

Step 2. Select LINQ and selected my LINQ Data Context (in my case, it was called quizDataContext)

image

image

Step 3. Select  Courses. Click on Advanced… button

image

Step 4. Check all the checkboxes… and click Ok. Then click Finish

image

Step 5. Here is the final output…

image

You can see that everything appears just fine, and the page would work flawlessly. Right?? I just tried it with one record (inserted using SQL Management Studio directly) and you can see that I have a simple little page with almost no effort, zero code, and fully working.

image 

Let’s get to the facts now… and start by pressing Delete in the row above. It is not just the ROW which went away… it is the ENTIRE GRID!!!!

How do you take care of such scenarios? My answer will follow in the next post…

Currently, I am more interested in finding out different ways people use to overcome this limitation.

Thanks for your response… in advance!! Wave
Rahul


Quote of the day:
All things are difficult before they are easy. - Dr. Thomas Fuller



blog comments powered by Disqus

Comments

Search


Tags



Categories

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

All Items
Sign in

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2010, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0