Wrox Programmer Forums
.NET Framework 1.x For discussing versions 1.0 and 1.1 of the Microsoft .NET Framework.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 1.x section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 12th, 2006, 04:30 PM
Registered User
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update Button in DataGrid

Hi, Im a new member of Wrox.
I need a help.
I want to update my records through DataGrid
The problem is while using the Textbox control I cannot retrieve the New values inputted by me.
Plz. help me as soon as possible. If possible plz. also mail me to bibin_austin@yahoo.com

Old January 28th, 2006, 08:22 AM
Registered User
Join Date: Jan 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

hai bibin
   i think you are just started using the datagrid. from the posting nobody can recognise what the real proble is. Any way u can use the asptemplate coloumn

<asp:TemplateColumn HeaderText="Name">
        <asp:TextBox id="txtName" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Name") %>' />

use these codes in ur datagrid "Name" is the field in table to update.

int update function


void btnUpdate_click(Object sender, EventArgs e) {

    string strName = "";
        for (int i=0; i<MyDataGrid.Items.Count; i++) {

            DataGridItem _item = MyDataGrid.Items[i];
            TextBox txtName = (TextBox)_item.FindControl("txtName");

           strName = txtName.Text.toString().Tirm();
        //here you can write the query to update the database

    // after updation bind the grid again

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Panel & Button Control Harjinder ASP.NET 2.0 Professional 0 January 28th, 2008 06:13 AM
Datagrid.update() and DataAdapter.Update aarunlal ASP.NET 2.0 Professional 2 February 23rd, 2006 11:41 PM
coding for "update" button.. ct Excel VBA 4 August 12th, 2005 02:55 AM
Confirm Button after update fixitman Access 2 April 12th, 2004 03:28 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.