473,804 Members | 4,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detailsview - how do I add the first record?

Help...

I have a brand new database table and I open the page that has a
DetailsView control that is bound to that table it does not show
anything - not even a new button - so how can I add the first
record??

The reason I ask is because I have a generic page that will display
data from any table. Therefore I cannot add the row programmaticall y
-
I have tried adding blank values (by querying the SQL Server schema
(SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCH EMA.COLUMNS WHERE
TABLE_NAME = MyTable) but that does not work if the table has foreign
key constraints etc..

Any ideas?

Thanks in advance,
Jon

dbgurus.com.au

Feb 1 '07 #1
1 1238
On Feb 1, 10:58 am, "JonBosker" <Jon.Bos...@Yah oo.comwrote:
Help...

I have a brand new database table and I open the page that has a
DetailsView control that is bound to that table it does not show
anything - not even a new button - so how can I add the first
record??

The reason I ask is because I have a generic page that will display
data from any table. Therefore I cannot add the row programmaticall y
-
I have tried adding blank values (by querying the SQL Server schema
(SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCH EMA.COLUMNS WHERE
TABLE_NAME = MyTable) but that does not work if the table has foreign
key constraints etc..
SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCH EMA.COLUMNS WHERE
TABLE_NAME = MyTable

will return you result when it exists.

That is you have to insert the row into COLUMNS before.

For example (abstract)

if (table_has_no_r ows)
{
insert_row();
} else {
get_rows();
}

Feb 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1905
by: TdarTdar | last post by:
HI, I have a asp 2.0 page that has a sqldatasource and a detailsview i have enabled the inserting updating deleting in the datasoure. I have a blank table that has no records. I run the page.. I get a blank page how can I toggle the detailsview to show the new insert form if it has no records returned? So I can insert the very first record into the system.
1
10073
by: Shawn Wildermuth | last post by:
I have a *single* SqlDataSource that loads up a single result set that I show in a GridView. In the GridView, i've added a "Select" button and handling the SelectedItem event. I also have a DetailsView (though FormView has this same issue) where I want to be able to set the current item to bind to from the DataSource. All the examples I've seen use two data sources and on every *select* they do another round-trip to the Database (which...
12
8707
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press update after making changes, but I don't want that update button. How can I get the updated object when the user presses one of my other action buttons?
0
1248
by: Seok Bee | last post by:
Dear Experts, In my web application, I have a Master/Detail display of records using Gridview and DetailsView controls. Whenever, I made a selection of a record from the Gridview control, the detail information of the record will be displayed in the DetailsView control. Information in the editable in the detailsview by allowing user to have the edit option. On top of that I also allow user to add new record through the detailsview...
0
1876
by: jeffmagill | last post by:
Hi Everybody, I'm really hoping that someone can help me out because I have spent too much time on this project already! Basically, I have a DetailsView that handles all the Edits for a GridView - each row has an edit button and clicking on this should trigger that record to be loaded into the DetailsView for editing. The problem is that the record never gets loaded into the DetailsView. Instead, the DetailsView always and only...
1
5948
by: needin4mation | last post by:
Not sure what I'm doing wrong here. I have a gridview and a detailsview. The detailsview is set to insert by default. When I insert data the detailsview it works. The data goes in the database. The gridview on the page, however, never refreshes to show the new row. The sql for the gridview defaults to a LIKE % and when the page first loads I can see all the records. If after I try an edit a gridview record and delete or cancel, then...
2
11640
by: mike | last post by:
I have a page with a LoginView which contains a Gridview and a DetailsView, each in its own UpdatePanel The problem that I am experiencing is that when I select a record in the Gridview (using a SelectButton), the selected record is shown in the DetailsView, which is correct - however, when I choose "Update" on the DetailsView I am presented with the EditItemTemplate which contains the first record in the DetailsDataSource. The code...
2
4386
by: David Ching | last post by:
I am not getting any response to my previous question on reusing a DetailsView to insert and edit the selected row in a GridView. So I'll ask an even more basic question. Newbie alert! ;) When the user clicks the Edit link in a GridView, is it common to use a DetailsView to edit that row instead of putting the GridView into Edit mode and editing the row in place? I would assume so, because the GridView does not typically have columns...
0
1017
by: Seth Williams | last post by:
I have a Master/Detail page - the DetailsView is set to ReadOnly, and AutoGenerates Delete/Edit/Insert buttons The Gridview has records - when a record is selected, the DetailsView is populated I can successfully Delete/Insert/Update - no problem However, since it's set to ReadOnly, the DetailsView is not visible when no records are in the Gridview and the corresponding table I need it to be visible, so I can choose the Insert...
5
3470
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration: default.aspx:
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6856
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.