How to automatically copy the value of a gridview row to a field in the gridview footer row


 How to automatically copy the existing value displayed in a gridview row to a field in the gridview footer row.  Both fields are of the same type.  The gridbew row is used to modify information and the footer row is used to add new information to the db.




Thank you,

2/29/2008 12:10:25 PM 72751 articles. 3 followers. Follow

5 Replies

Similar Articles

[PageSpeed] 26

2/29/2008 12:24:51 PM

1 - turn column into template

2 - Add a label to footer template

3 - Say you add a select command so you can select the desired row


Protected Sub GridView1_SelectedIndexChanged(ByVal sender as Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
     dim RowIndex as integer = GridView1.SelectedIndex
     Ctype(GridView1.FooterRow.FindControl("NameOfUrLabel"), Label).text  = _
     Ctype(GridView1.Rows(RowIndex).Cell(1).FindControl("Lable1"), Label).text 
     ' that last control name is whatever is in your item template
end sub
I am not anti social, am just not user friendly
2/29/2008 1:01:48 PM

Can I do this on page load since the data is already in the gridview1.rows Label3?

2/29/2008 5:01:49 PM

But how would you know it was selected by the user? I thought you said that when the user selectes it that when you want to put in the footer.  Even though you can get at SelectedIndex there is the change it is not valid!  You would need

if isPostback then

     'do it here


But even this will not gurantee that you have a selectedIndex.  Remember you want to have the click anywhere on the row and expect selected index to change well that will not happen.  So you need to think of how and when selectedindex is valid.


I am not anti social, am just not user friendly
2/29/2008 5:27:05 PM

Thank you for your guidance,

3/1/2008 12:21:14 AM

Similar Artilces:

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

Data Controls insert rows into gridview then insert rows from gridview into SQL Table
Hello there, I'm still new at performing miracles with code . Currently I am having trouble with my latest coding adventure I have a web application which records jobs and labour assigned to jobs. The issue in particular I'm having is the way in which labour is to be assigned. I want to use standard controls (Textbox, Dropdownlist) to record the values into a gridview (ie,put multiple rows into the gridview using the controls). Then, when all the inserting is complete, the user clicks a submit button to insert all the rows from the gridview into a database table. The reason for...

How can i copy one row or more from 1 gridview to the same gridview and other gridview ?
Hi All,      Hi, i am using visual web developer 2008 express, i need to copy some rows in a grid view to the same gridview and other gridview help me with the code when press copy. Thanks. My code : code Behind: using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; using System.T...

does anyone know how to do that, when I click the last row of the gridview, the gridview will automatically add an empty new row for me.
does anyone know how to do that, when I click the last row of the gridview, the gridview will automatically add an empty new row for me.   thanks hi there,the only I could think of for now is is enbale footer rowthen hide it onpageload so when last row click set footer.visible to true  ...

copying selected gridview row into same gridview
Kind of like a quickcopy feature??Any sugggestions?    Hi You can make use the import row functionality of grid view.RegardsRobins John It might be better to copy a row in the underlying data and then rebind GridView to the data with the new row.Steve Wellens My blog SGWellens:It might be better to copy a row in the underlying data and then rebind GridView to the data with the new row.  This does sound like the better way to do it.  How do you copy the current selected row?  It depends on what database object you are using. Basically, grab the d...

Problem copy gridview row between gridviews
Hi, I have a gridview and a sqldatasource, and the select statement isSELECT DISTINCT p.Product_ID, [Product Name] AS Product_Name, [Sell Price], Quantity FROM Products AS p INNER JOIN Product_Categories AS pc ON p.Product_ID = pc.Product_ID WHERE (p.Product_ID LIKE '%' + @product_ID + '%') and ((pc.Category_ID LIKE @Category_ID) OR (pc.Category_ID LIKE @Category_ID2)) ORDER BY product_nameThe user just choose products to be showed by categories or brands in a dropdownlist and i invoke the databind of the sqldatasource with the above sql statement. I need to search in the gri...

Selecting a gridview row and keeping the last selected row in a gridview highlighted after mouse moves over a new row.
What is the best way to show a gridview row highlighted once selected and keep it highlighted once the mouse moves over a different row? Thanks, Steve hi,you can use <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="#FFFFFF" /> plz let me know if i misunderstood you Thanks for your help. One problem; however, is that after the row has been selected and I check the "grid.SelectedIndex" it has a value of -1 and not the index of the row that was selected on the grid. What do you recommend? Thanks, Steve hi, sorry i din...

Error with Gridview when i delete the row that have only one row in gridview
 Dear all, i develop with 2005 and use gridview and set enable deleteing =true. I can delete record in gridview properly but when gridveiw has only one row and then i'm clike delete button , the error occurs :   Server Error in '/it' Application. Specified argument was out of the range of valid values.Parameter name: value Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeExce...

Is there a control that offers the same data presentation as a GridView, but allows users to copy and paste many rows/columns at once?
 Hi Is there a control that offers the same data presentation as a GridView, but allows users to copy and paste many rows/columns at once onto the grid? What I mean is some grid that 's as flexible as MS Excel grid for example.  Any suggestions will be very much appreciated.E The Repeater control is a highly customisable data presentation controlRohin.NET developerNever trust a computer you can't throw out a window. - Steve WozniakPlease remember to click on 'Mark as answer', if this post helped you......

Copy row from sorce gridview to destination gridview
Hi, i am using Visual Web Developer 2005 Express, i work with Visual Basic, i need to copy rows from source gridview  to destination gridview , if possible i want to click anywhere in a row of the source gridview and invoke a method to copy the row to the gridview destination, or i can mark one checkbox and press the copy button to copy one or more checked rows. Any one can help me with the code? I am new with the .NET, if you could just give a brief description of what libraries i need to include, and variables i need to create. Thank you. Hi:  Some code snips you can use: 1. A...

copy data from excel row to gridview row
Hi All, I need to copy data from excel to gridview. I have to select a row and press Ctrl+C to copy from excel, then I have to paste it in Gridview. Thanks in advance. I dont think you can Copy and Paste data from Excel to Gridview.But you can export data from Excel to GridView control, please check the below articles. a Reply as 'Answered', not only GAIN us some POINTS, but it also HELP others to find RIGHT solution....

DropDownList in GridView populated from value in gridview row
I have a standard GridView with 5 fields one of which is "state". I want to add a sixth field (consultant) which would pull back data from a different DB table based on the value of the state field. ie- NY -> John, Mary.     IL -> Joe, Fred, Mike........  1 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowDataBound="PolicyRowBound" DataSourceID="UnassignedPoliciesSource"> 2 <Columns> 3 <asp:BoundField DataField="policyNumber&quo...

GridView.Rows(Column=ID_PK) to GridView.Rows(Column=DropDownListTeamplteField)
Hi Guys,I wonder how I can assign the PrimaryKey in each GridView Row to the template field in the same row. whereas the template field is filled with a dropdownlist thatshould show the values for retrieved in a different table through the GridView Row primary key (which serves as the SELECT parameter to get these values) The GridView looks like this:<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="C_ID" DataSourceID="GetC_IDs"> <Columns> <asp:BoundField D...

Gridview.Rows.Count not incremented after call to GridView.Rows.AddAt()
Hi All, I've got a grid view that was created from a static DataTable.  I then wish to add a row to the gridview.   However the GridView.Rows.Count does not increment after I add a row to the underlying Table extracted as gv.Controls[0] as Table.  I need the gridview to maintain the correct number of rows because a post processing routine then accesses the newly addrows throught the gridview.Rows[i].Cells[j] calls. Thanks, cr  static protected void AddRow(GridView gv, out string sOut) { Table t = gv.Controls[0] as Table; GridViewRow r = new GridViewRow...

Web resources about - How to automatically copy the value of a gridview row to a field in the gridview footer row -

Facebook Users Automatically Checked In To Events They RSVPed Yes To
A reader tipped us off that Facebook is automatically checking in users at events that they RSVPed they would attend. continued… New Career ...

Now Users Can Remove Contacts Automatically Saved by Facebook’s Friend Finder
Two weeks ago, many Facebook users began asking questions about curiously good recommendations suddenly appearing in Facebook’s “People You May ...

App Store - Gmail inbox software to efficiently manage emails, automatically send/upload ...
Get Gmail inbox software to efficiently manage emails, automatically send/upload files to cloud storage(Dropbox, Box, and G Drive), ...

Automatically organize your desktop icons into shaded areas called Fences! - YouTube
Fences® is the most popular desktop organization tool used by millions of users worldwide. Create shaded areas called "fences" to automatically ...

CSAIL fixes software bugs automatically, in any language, by copying from safer applications
A new system can repair bugs in software using smart processing that imports functionality from other programs, all without access to source ...

Emailing porn at work not automatically sackable, court finds
Australia's federal court has upheld a ruling that emailing pornography in the workplace is not automatically a sackable offence.

Shazam iPhone app now listens for music, TV shows automatically
Shazam has updated its iPhone app to tag songs, TV shows and more on its own, no longer requiring users to open the app and tap a button.

App of the day: Human for iPhone automatically tracks your movements
Human for the iPhone is an activity tracker that automatically distinguishes between different types of movement.

iPhone 5 automatically rotates using Cycloramic App. - YouTube
[NEW VIDEO] Cycloramic 2.0 update teaser vid with panoramic photo preview: Cycloramic has been Awarded ...

Resources last updated: 11/24/2015 3:25:03 PM