anjali khan

anjali khan

  • NA
  • 293
  • 65.7k

how to edit the column in gv without using any button?

Aug 6 2015 2:21 AM

i have a gridview ..in this i am display the data using data table without
using data base..so it is showing the data..
now i want if i click on gridview cell so it should be editable and save the data in tada table
it is possible or not..
i want the code please dont share me link because i am stuck in my task...

design code ///
<div style="text-align: center; background-color: Silver; width: 100%">
       
        <asp:GridView ID="gridview1" runat="server" AutoGenerateColumns="false" OnRowDataBound="OnRowDataBound"
         OnSelectedIndexChanged="OnSelectedIndexChanged" AlternatingRowStyle-BackColor="White"
            Font-Bold="true" Width="100%" class="gv">
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="Id" />
                <asp:BoundField DataField="Name" HeaderText="Name" />
                <asp:BoundField DataField="City" HeaderText="City" />
            </Columns>
           
        </asp:GridView>
    </div>

ce code ////

protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                DataTable dt = new DataTable();
                dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id"), new DataColumn("Name"), new DataColumn("City") });
                dt.Rows.Add(1, "abc", "Lathur");
                dt.Rows.Add(2, "Rooppa", "Chennai");
                dt.Rows.Add(3, "Monika", "Bangalore");
                dt.Rows.Add(4, "Jyoti", "Chennai");
                dt.Rows.Add(5, "Radhika", "Jabalpur");
               

                gridview1.DataSource = dt;
                gridview1.DataBind();
            }
        }


Answers (5)