hi friends,
i am display the data using data table ina gridview ..
now i want that if i click on any cell in a gridview data shold be edit and save the data in a data table using jquery or java script..
please share me the code ...
Design page..///
div style="text-align:center"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns = "false" OnRowDataBound = "OnRowDataBound" BackColor="Gray" AlternatingRowStyle-BackColor="Silver" Width="100%">
</asp:GridView> </div>
code///
protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) {
BoundField bfield = new BoundField(); bfield.HeaderText = "Name"; bfield.DataField = "Name";
GridView1.Columns.Add(bfield);
TemplateField tfield = new TemplateField(); tfield.HeaderText = "City"; GridView1.Columns.Add(tfield);
tfield = new TemplateField(); tfield.HeaderText = "View";
GridView1.Columns.Add(tfield); }
this.BindGrid(); } private void BindGrid() {
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[3] { new DataColumn("Id", typeof(int)),new DataColumn("Name", typeof(string)),new DataColumn("City",typeof(string))});
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");
GridView1.DataSource = dt; GridView1.DataBind(); }