Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have grid view with id=gv which binds at runtime ...
also i make first column invisible..
now on image button click i want to update data with that invisible column value..but i cant get that invisible column value...
plz give some idea where i m wrong..
here is my code on image button click event..

C#
protected void imgbtnDelete_Click(object sender, ImageClickEventArgs e)
    {
        string strcon = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
        SqlConnection conn = new SqlConnection(strcon);
        
        GridViewRow selectedRow = ((Control)sender).Parent.NamingContainer as GridViewRow;

        gv.SelectedIndex = selectedRow.RowIndex;
        string id = selectedRow.Cells[1].Text;
       
        string qry = "update dbo.[user] set isDeleted='false' where userId='" + ID + "'";
        SqlCommand cmd = new SqlCommand(qry, conn);
        conn.Open();
        int r = cmd.ExecuteNonQuery();
        if (r > 0)
        {
            Response.Redirect("editUser.aspx");

        }
        conn.Close();
    }
Posted
Updated 31-Oct-12 4:13am
v2

1 solution

Hi could you post up your code for the gridview.

also is the imagebutton inside the gridview or outside the gridview?

P
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900