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 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

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

    Rakesh Chaubey

  • #725550

    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;
    protected void GV_OnRowEditing(object sender, GridViewEditEventArgs e)
    GV.EditIndex = e.NewEditIndex;
    protected void GV_RowCancellingEdit(object sender, GridViewCancelEditEventArgs e)
    GV.EditIndex = -1;
    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());
    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;

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

    Blog :

  • #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

  • #725567
    refer below response too in your previous thread

    Your Hard work never fails

  • #725639
    Hello kirubaharan,

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

  • 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.