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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
anjali khanPosted Jul 30, 2015, 12:45 AM
<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();
}
}
Resmy RaviPosted Jul 29, 2015, 7:38 AM