Solved

Insert Extra Row into Gridview

Posted on 2007-11-28
6
2,991 Views
Last Modified: 2008-02-01
Hi All

I have a Gridview which is databound which by default has a column containing textboxes within it's ItemTemplate.

What I would like to do is add an extra row (which will include a textbox) at the top of my Gridview which will enable me to add a value and then automatically populate the remainder Gridview rows.

Could any point me in the right direction on how to achieve this?

Many thanks

Rit

0
Comment
Question by:rito1
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:Roopesh_7
ID: 20366243
Check this link that may help you

http://forums.asp.net/p/1086446/1618481.aspx
0
 
LVL 1

Author Comment

by:rito1
ID: 20366323
Thanks Roopesh_7, I think I see how to insert an extra row. But would you or anyone know how I could make each row within a column reflect the value within a textbox which..

What I am trying to acheive is an 'Apply to all' function as some of the values within my gridview would be the same for each row.

For your info, my Grdiview functions similar to a spreadsheet thanks to the following posting... http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22908492.html

Many thanks

Rit
0
 
LVL 37

Expert Comment

by:samtran0331
ID: 20366737
It would be very similar to the post you linked to:

   Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        For Each gvr As GridViewRow In gvPeople.Rows
            If gvr.RowType = DataControlRowType.DataRow Then
                CType(gvr.FindControl("tbFirstName"), TextBox).Text = "EveryoneIsNamedSam"
            End If

        Next
    End Sub
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
LVL 1

Author Comment

by:rito1
ID: 20372480
Oh yeah, I see what you mean. I will piece this all together today and come back to you on the outcome.

Thanks for you help!

Rit
0
 
LVL 1

Author Comment

by:rito1
ID: 20372656
Hi

Regarding adding a new row to my Gridview, I am already using the Header row for header information and what I need to be able to do is add another row after the header but before the databound rows.

I can't seem to locate a way to acheive this as yet.

Does anyone have any ideas that they would mind sharing?

Rit
0
 
LVL 37

Accepted Solution

by:
samtran0331 earned 500 total points
ID: 20373082
>>what I need to be able to do is add another row after the header but before the databound rows.

I would do it by creating my own datatable with columns that match the database query you're returning, then add a blank row to the datatabe, *then*, loop through the database query and add the rows to my custom datatable
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Title # Comments Views Activity
ASCX file or a newer alternative? 1 42
tutorial for ebay api 3 56
jQuery - following an example but can I save data server side? 20 59
RLDC Reporting in Visual studio 11 31
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

821 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