Add a New Row to an Empty GridView

I am using a GridView control for an hours entry function.  I have it working the way I want (more or less) for editing and deleting existing records.

That said, each week when a user comes in to enter their hours there are no records to display so I'm at a bit of a loss as to how to present an "empty record" for them to start on.  Things I'm considering are:

  • Simply adding controls to the top of the page that are basically always there to facilitate entry of new records.
  • Investigating the ShowInsertButton of the asp:CommandField and whether I can get this to display when there are no records
  • Some other feature that would help that I am currently unaware of

Any thoughts on these options of others I have not considered would be welcome.

12/27/2007 5:02:03 PM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 59

I'm guessing you want to look at the emptydatatemplate in gridview for this.  Here is some docs on it.


Peter Kellner and blogging at
12/27/2007 5:35:55 PM

Thanks, I'll look into that.

I have another GridView question.  I can't seem to get the insert functionality working using the ShowInsertButton attribute in the CommandField tag.  Is this supported in the GridView control?  When I click the "New" link, the forms posts back but does not return with input fields.  In fact there seems to be no visible change at all.

I'm wondering if I'm doing something wrong or if the GridView doesn't handle this?

Thanks again!

12/27/2007 6:23:28 PM

Similar Artilces:

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

does anyone know how to do that, when I click the last row of the gridview, the gridview will automatically add an empty new row for me.
does anyone know how to do that, when I click the last row of the gridview, the gridview will automatically add an empty new row for me.   thanks hi there,the only I could think of for now is is enbale footer rowthen hide it onpageload so when last row click set footer.visible to true  ...

Add a button to add a new row and insert the new record to gridview
Hello, I have a gridview1 on a page attached to a SQLDataSource.  The gridvioew page is displayed when a selection from a drop down box on the master page matches the FK field (partID) on the gridview page via querystring.  I would like to add a buttton that allows me to add a row to gridview1 without losing the information already displayed, typed in, or updated.  I have the PK and 8 check box feilds set as bound field (DetailID) and all of the remaining 10 text fields converted to template fields.  What is the best way to add this functio...

How to add a new row into gridview using Objectdatasource control
Hi, I am binding data into the gridview using objectdatasource control. I am able to perform the update and the delete functionality. But I need to insert a new row into the gridview and then somehow wire up the objectdatasource control to do the insert routine for me. I am using business logic layer plus the dataaccess layer along with stored procedures to achieve the above. Can some one tell me how to perform the insert routine? Hi guyind, It is no matter which datasource control you use, ObjectDataSource or SqlDataSource. You can set InsertMethod into ObjectDataSource to insert a new r...

How to add empty rows(with controls like textbox,dropdown) to Gridview
Hi, How to add empty rows with controls (5 repeated rows) to the gridview in the Page Load event. and how to read the values from each row to save into the database when click on Save Button (Multiple insertion).  Please suggest me anyone. Thanks Sriniavs     Hi ch.srinivas1700, You can bind a dummy data source to GridView to show the empty GridView: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" OnInit="GridView1_Init">        <Columns>  &...

Add a new row after current row in gridview
Is there a way to add a new row after the current row in a gridview by clicking a "+" add button, that is beside that current row.   Or is there a way with forms view to have a row of text boxes for data entry then you click the "+" add button beside that row of textboxes and a new row appears below for data entry?  Thanks Hi, Check below link whose last line is available for entry of a new row: You can set footer to invisible by default and set it to visible by clicking "+" button.NOTE:If you find m...

How i add New row to gridview when i click Add button
Hi, I have Gridview control , it is populated from Products Table from my database ProductNo,ProductName, ProductPrice, PrductCategorytype I added Edit and delete buttons to Gridview. Here  according to my user requirement  , i shuld add ADD button outside Griedview contrl, for Inserting New records into database  when i click ADD button But here  How i add New row to gridview when i click Add buttonadilahmed  Thanks and RegardsS.K.Vignesh----------------------Do remember to "Mark as answe...

Help need in gridview to display one row initily and add the new row at runn time
Hi,    Am creating the Gridview in that i put to HTMLSelect control and i populate item value from the database in ItemTemplate. Now i want to display only one row initily with the two HTMLSelect Control and if user want new row the can add by click the addnew row button. How to go with this...? I dont know how to Display only one row initily and add the new row at the end of the item template at the run time can any one help me.   Thanks Hi, The GridView rows collection's Count property is equals to the row number in it's datasource. If...

how to add new row in gridview
Hi Friends,I am working on the gridview,so I am updating the data in the gridview automatically without writing any code, i.e I want to insert the new row in the table from the gridview and it has to update in the table after clicking on the save linkplease any one give me some suggestions.............. Thanks & RegardsGeeta   See if this helps: replies as answers if they helped you solve the problem. hai friend... try to refer this link this is very useful one

Add new row to a GridView
I am writing an app that displays a list of conference rooms in a GridView and programmatically inserts Group Rows when the location changes.  You can view a graphic here: the DELETE button on a given row is clicked I would like for the called subroutine to get an ID # (or other value) via the CommandArgument and/or CommandName.  To accomplish this I am using the code below (Code Listing 1).  The code successfully generates the GridView shown in the figure above but the CommandArgument data does not seem to be ...

Add new row to GridView?
Over my head - I have GridView1 and Gridview2.  When a row in GridView1 is selected GridView2 displays all rows where GridView2.ZL_ID = GridView1.L_ID. I can edit and delete the rows in Gridview2 but how can I add a new row?  Is there not an insert property for GridView? Thank you  There is no ADD property for the gridview like the edit/select/delete.What you must do is just add the new record to the gridview datasource, then rebind the gridview with the updated data source.So if you gridview is bound to a dataset from a database, you need to add the new record then r...

Previous rows display when a new row add in GridView (in UpdatePanel) after hitting enter in address bar
I am having a problem in GridView using UpdatePanel. I have UpdatePanel which contains a GridView. When I enter rows in GridView and refresh a page it remove rows from Grid and if I enter again it shows only new entered row, works fine. But when I enter few rows in Grid then click on address bar hit enter on it, it removes the rows from Grid and when I again enter a row again then it shows new with previous rows. Can anybody tell me where am I doing a mistake. Thanks in advance. It works fine in debug mode but when I deploy the application on server, it shows previous records with new r...

How to add new row in Gridview
Hello , I create Database called Test which has table Emolyees has tables : EmployeeID , LastName and City I use GridView with SQLDataSource -- In Default.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns="" > <head runat="server"><title>Untitled Page</title> &...

GridView Add New Row
I have a gridview and needed to add a new item row. My users preferred the row be at the top and not at the bottom so using the FooterRow was out of the questions. I added the new row and all it's controls just fine as the first row in the datagrid. But then I ran into one weird problem. I add two link buttons, one to use for the "Save" and the other t be used as the "Cancel". Now, when adding the link button dynamically, the first thing I noticed was that you do not have an "Onclick" attribute. I have tried setting the "Command Name" to ...

Web resources about - Add a New Row to an Empty GridView -

GridView SelectedItem Binding Gotcha in WinRT
Last night when I was doing some WinRT hacking I was trying to setup databinding to the selected item in the GridView control and I ran into ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Advanced Search Gridview Latest News Releases All ...

CNW Group
... Services Beyond the Wire About CNW my CNW CNW Access CNW Directories Financials Webcasts Events my CNW All News Releases Advanced Search Gridview ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Add a Filter Gridview Latest News Releases All Today ...

New CmdLets of Powershell 2.0
New CmdLets of Powershell 2.0

Price Drop: Softbox
... objects- create product reflection- changing the background with something more interestingUse it as:- softbox- honeycomb softbox- gridview ...

Profile.aspx: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 25 Oct 2012 - Upcoming stories is a community based news site edited by our members. It specialises in .NET development techniques, technologies and tools including ...

View Features - ExtendASP
Call 847-681-9827 or Request a Demo View Features Testimonials Pricing About Us Coming Soon ExtendASP exposes every feature, more than any other ...

Resources last updated: 12/23/2015 6:46:23 AM