You must Sign In to post a response.
  • Category: ASP.NET

    How to edit,update,delete,select data in sql server from gridview(am attach my design )


    Are you looking for a way to edit,update,delete,select data in gridview using SQL ? then read this thread to know how to do it



    how to edit,update,delete,select data in sql server from gridview.

    I Have More Number Of Column in database table.My design is


    Enter the S_No .............

    Search Cancel

    When i click Search to show the grid View data.now how to edit,update,delete,select data in sql server from grid view.Pls help me,am waiting for u r Code.I need step by step process and code.Pls help me
  • #725538
    http://www.aspdotnet-suresh.com/2011/02/how-to-inserteditupdate-and-delete-data.html


    Try this above Url ...It have all info about grid.

    Regards
    Rakesh Chaubey
    rakeshchaubey1989@gmail.com

  • #725550
    Hi,

    Your question is incomplete if you provide some detailed information then only we give some better solution out of this. In your post your mentioned you need to edit update select delete operations using SQL DataBase.

    Use below sample code may be it might be helpful to you..

    protected void Bind_GV()
    {
    BLayer obj = new BLayer();
    DataSet ds = //data;
    GV.DataSource = ds;
    GV.DataBind();
    }
    protected void GV_OnRowEditing(object sender, GridViewEditEventArgs e)
    {
    GV.EditIndex = e.NewEditIndex;
    Bind_GV();
    }
    protected void GV_RowCancellingEdit(object sender, GridViewCancelEditEventArgs e)
    {
    GV.EditIndex = -1;
    Bind_GV();
    }
    protected void GV_OnRowDeleting(object sender, GridViewDeleteEventArgs e)
    {
    BLayer obj = new BLayer();
    GridViewRow row = (GridViewRow)GV.Rows[e.RowIndex];
    string Mat_Id = ((Label)row.FindControl("lblMat_Id")).Text;
    string Grade_Id = //fetch data
    string Item_Id = //fetch data
    Result = Delete_Data( Mat_Id, Grade_Id, Item_Id, UserId.ToString());
    Bind_GV();
    }
    protected void GV_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
    BLayer obj = new BLayer();
    Label Mat_Id = (Label)GV.Rows[e.RowIndex].FindControl("lblMat_Id");
    Label Grade_Id = //fetch data
    Label Item_Id = //fetch data
    TextBox qty = (TextBox)GV.Rows[e.RowIndex].FindControl("txtEditQty");
    Result = obj.Update_Details(Mat_Id.Text, Grade_Id.Text, Item_Id.Text, qty.Text, UserId.ToString());
    GV.EditIndex = -1;
    Bind_Tender_Quantity_GV();
    }



    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #725564
    Hello kirubaharan,

    Just Drag and Drop GridView Control in WebForm and then Bind data using Wizard and select Perform Update, Delete actions.

    If you are inserting GridView using Code method, then you have to Write Codes in Backend for performing actions like Editing, CancelEditing etc. To Write Code, Just right click on Gridview and Choose Properties. Then Choose Event and Double Click on RowEditing, CancelRowEditing, RowDeleting events and write codes as written by Mr. Naveen above post.

    All the Best.

    -------------
    Glad to be,
    John Bhatt
    Editor - DNS Forums
    https://www.pyarb.com

  • #725567
    refer below response too in your previous thread

    http://www.dotnetspider.com/forum/328738-How-edit-update-delete-select-data-sql-server-from-gridview.aspx

    Regards
    N.Ravindran
    Your Hard work never fails

  • #725639
    Hello kirubaharan,

    Please check the below link to get complete sample code & project as well for this.

    http://www.dotnetgallery.com/kb/resource10-How-to-perform-insert-update-delete-and-select-rows-in-ASPNET-gridview-c.aspx


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.