SA Developer .NET

Welcome to SA Developer .NET Sign in | Join | Help
in Search

Edit DataGrid in ASP.NET

Last post 07-25-2008, 16:24 by Raithlin. 4 replies.
Sort Posts: Previous Next
  •  07-22-2008, 15:17 13583

    Edit DataGrid in ASP.NET

    Hi all,

    I use a DataSet.Table[0], which is populated from the database, as the datasource for my datagrid.

    After I databind to the grid and display it on the web page, I want to edit some cells in the grid, and then click a button to update the grid, save the changes to the database, and show the CHANGED datagrid again.

    How is this done?

    Thanx.

     

  •  07-22-2008, 16:02 13584 in reply to 13583

    Re: Edit DataGrid in ASP.NET

    it can be many ways to achive the above requirment.

     as you said u need to edit some of the cells(column) in the girdview.. 

    1. You need to convert those bound column to template columns & define the edit template

    2. Add the Edit Button Column

    3. In RowEditing Event .. change the gridview editindex to e.neweditindex

    4. In RowUpdating Event get new values & update the database.

    5. Bind the gridview again

     

    Hope it helps

     

  •  07-23-2008, 8:15 13594 in reply to 13584

    Re: Edit DataGrid in ASP.NET

    Thanx.

    I haven't tried the dataVIEW, but the dataGRID. I'll check it out -

    [maybe I'm a bit confused between the two...haha...:-)]

    On paper your suggestion makes sense, so I'll surely try it out today.

     

     

  •  07-23-2008, 8:32 13595 in reply to 13594

    Re: Edit DataGrid in ASP.NET

    WhoKnowsWhat:

    Thanx.

    I haven't tried the dataVIEW, but the dataGRID. I'll check it out -

    [maybe I'm a bit confused between the two...haha...:-)]

    On paper your suggestion makes sense, so I'll surely try it out today.

     

    Maybe you were a bit confused; it's a GRIDview vs. dataGRID, not a dataVIEW. Smile


    Unscrambling Eggs: Decompiling ASP.NET
  •  07-25-2008, 16:24 13703 in reply to 13583

    Re: Edit DataGrid in ASP.NET

    You might try this tutorial... http://www.codersource.net/asp_net_datagrid_part1_azam.html

    or alternatively spend some time in this (18 part) series :)... http://aspnet.4guysfromrolla.com/articles/040502-1.aspx

    Both will give you a pretty decent idea of what to do.

View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems