Solved

Insert Extra Row into Gridview

Posted on 2007-11-28
6
2,981 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

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

9 Experts available now in Live!

Get 1:1 Help Now