Solved

Adding to Gridview from empty table

Posted on 2007-11-13
7
1,301 Views
Last Modified: 2013-11-26
Hello,

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?  

thanks,
0
Comment
Question by:kevinmeredith
  • 4
  • 3
7 Comments
 
LVL 3

Accepted Solution

by:
ITTechSolver earned 205 total points
Comment Utility
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.
http://www.codeproject.com/useritems/GridView_with_insert_line.asp
0
 

Author Comment

by:kevinmeredith
Comment Utility
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?

thanks
0
 

Author Comment

by:kevinmeredith
Comment Utility
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
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 3

Expert Comment

by:ITTechSolver
Comment Utility
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. ;)
0
 

Author Comment

by:kevinmeredith
Comment Utility
thats what i want to do is use a table from a dataset.  definitely let me know what he says.  thanks!
0
 
LVL 3

Expert Comment

by:ITTechSolver
Comment Utility


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

0
 

Author Comment

by:kevinmeredith
Comment Utility
thanks ITTechSolver
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now