how to edit perticular cell in a gridview using single click and store the data using enter or double click without using data base
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Resmy Ravi74 reputationPosted Jul 29, 2015, 3:38 AM EDT
anjali khanRank #4,788 · 325 reputationPosted Jul 29, 2015, 8:45 PM EDT
<div style="text-align: center; background-color: SkyBlue; width: 100%">
<h3>
GridViewh3>
<asp:GridView ID="gridview1" runat="server" AutoGenerateColumns="false" AlternatingRowStyle-BackColor="Gray"
Font-Bold="true" Width="100%" > <%--OnRowDataBound="gridview1_OnRowDataBound" --%>
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" ItemStyle-Width="50" />
<asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="50" />
<asp:BoundField DataField="City" HeaderText="City" ItemStyle-Width="50" />
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lbl1" runat="server" Visible="false">asp:Label>
ItemTemplate>
asp:TemplateField>
Columns>
asp:GridView>
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, "Anamika", "Bangalore");
dt.Rows.Add(2, "Sunny", "Chennai");
dt.Rows.Add(3, "Monika", "Bangalore");
dt.Rows.Add(4, "Jyoti", "Chennai");
dt.Rows.Add(5, "Radhika", "Jabalpur");
dt.Rows.Add(6, "Imran", "Jammu");
dt.Rows.Add(7, "Alok", "Delhi");
gridview1.DataSource = dt;
gridview1.DataBind();
}
}