Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Gridview, detailsview and inserting the first record

Posted on 2006-05-28
2
Medium Priority
?
584 Views
Last Modified: 2008-02-26
Hi,

I've set up a very simple master/details page with a gridview (selectable rows) and a detailsview.
That works fine for updating, deleting and inserting as long as there is at least one record in the SQLtable.

The gridview has a SqlDataSource with this SelectCommand: "SELECT type_id, type FROM Types"
The detailsview has a SqlDataSource too with this SelectCommand: "SELECT type_id, type FROM Types WHERE type_id=@type_id"

That last SqlDataSource retrieves it's selectparamater (@type_id) from the datagrid's selectedvalue.

Now when there's no record in the database, no gridview appears. And thus no detailsview can be shown because @type_id isn't provided.

How can I show the detailsview (in defaultMode=Insert) so I can put the very first record of that SqlTable?

Hope I made myself clear enough

Thanks in advance
kGenius
0
Comment
Question by:kGenius
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1000 total points
ID: 16785224
I believe that you need to add a blank record to the data source in order to get this to work.

Bob
0
 
LVL 7

Author Comment

by:kGenius
ID: 16802012
In the meantime I found the solution to the problem.
It is exactly as you say. "SELECT 0 As type_id, '' AS type" works perfect.
Thanks anyway.
You get the points

Greets
kGenius
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question