Solved

Insert Extra Row into Gridview

Posted on 2007-11-28
6
2,990 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

772 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