Adding to Gridview from empty table

Posted on 2007-11-13
Last Modified: 2013-11-26

I'm trying to use a Gridview to add data to a dataset Datatable starting with a blank Gridview.  I know the columns for it and they fixed.  What I would like to do is be able to have a blank row in the Gridview show up on page load and then be able add N number of rows.  In the end, i'd like to do some calculations on the data and then submit it to a DB.  but thats later on down the road.  My first step is to show a blank GridView and be able to add to it.  Any ideas?  

Question by:kevinmeredith
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3

Accepted Solution

ITTechSolver earned 205 total points
ID: 20275177
1) empty row insert:
Try to look at this. Btw there are many of modified gridviews, maybe you can find even better or somebody recommends his best.

Author Comment

ID: 20275612
thanks ITTechSolver.

I'm trying to look for something that will work using just the GridView and add another control like this is doing.  Any ideas?


Author Comment

ID: 20275715
I was also wondering how i could do this using a DataSet in and not use a SQL DB.  thanks again for your help, i reallly appreciate it
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.


Expert Comment

ID: 20275932
I think you can use only a table from a dataset, but you can use ObjectDataSource and use some methods there. Then you can write down method that will cooperate with whole dataset.
My colegue is like you, yesterday he asked me the same question and my answer was to use no data - gridviewrow that have display: disabled; style setup. I will ask him after 8 hrs, how he solved that.
I think you can access at event RowDataBound, GridViewRow and set the style for it. I know, this is poor sollution. ;)

Author Comment

ID: 20276979
thats what i want to do is use a table from a dataset.  definitely let me know what he says.  thanks!

Expert Comment

ID: 20296836

So the first row is some nodata row at the table.

I think, You can bind DataTable to the GridView as DataSource - from ResultSet get your disered table. You have to manually call DataBind(). I know, that I did some DataTableDataSource, if it will not work..
// He used system that I proposed, but instead of style setup, he used Visible change (this is his code):
        protected void gv_RowDataBound(Object sender, GridViewRowEventArgs e)
            if (e.Row.RowType == DataControlRowType.DataRow && ((GridView)sender).Rows.Count < 1)
                e.Row.Visible = false;

Open in new window


Author Comment

ID: 20298756
thanks ITTechSolver

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

623 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