Missing Insert functionality in GridView – Part 1

by rahul 7/6/2009 12:04:28 PM

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

Rahul Soni

Rahul Soni  Twitter

 LinkedIn

 Facebook

 Email me



Vivek Kumbhar

Vivek Kumbhar  Twitter

 LinkedIn

 Facebook

 Email me


Stack Exchange

profile for Vivek at Server Fault, Q&A for system administrators and IT professionals

profile for Rahul Soni at Stack Overflow, Q&A for professional and enthusiast programmers

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

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 2012, Rahul Soni

Powered by BlogEngine.NET 1.4.5.0