简体   繁体   English

如何使用asp.net C#中的绑定功能在GridView中编辑删除数据行,其中数据来自数据库

[英]how to edit delete data row in gridview where data come from database using binding function in asp.net c#

I need a little help. 我需要一点帮助。 I am binding data from database to gridview in asp.net c#, my problem is that when I add, edit,delete and select button in every row then when I click on edit or delete button then no any action perform. 我将数据从数据库绑定到asp.net c#中的gridview,我的问题是,当我在每一行中添加,编辑,删除和选择按钮时,然后单击编辑或删除按钮时,则不执行任何操作。 can anyone help me.Thank you in advance. 谁能帮助我。谢谢您。

here is source code for that 这是该源代码

    string str = "select max(trans_id) from purchase";

    DataSet ds = new DataSet();
    ds = c.FetchData(str);
    if (ds.Tables[0].Rows.Count > 0)
    {
        GridView1.DataSource = c.FetchData("select * from pur_trans where trans_id=" + ddltansid.SelectedValue.ToString() + "".Tables[0];
        GridView1.DataBind();
        GridView1.Visible = true;
    }
    else
    {
        GridView1.Visible = false;

    }![enter image description here][1]

You need to add the events for edit and delete. 您需要添加事件以进行编辑和删除。 Please go through below given link and read all the steps given into it: 请通过下面的给定链接,并阅读其中给出的所有步骤:

http://www.codeproject.com/Articles/667599/Add-Edit-update-Delete-gridview http://www.codeproject.com/Articles/667599/Add-Edit-update-Delete-gridview

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM