DATA GRID VIEW - ASPX : "Aoutoid"
DATA GRID VIEW - ASPX : "Aoutoid"
DATA GRID VIEW - ASPX : "Aoutoid"
CS CODE-------------------------using
using
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
System.Web.UI.WebControls;
System.IO;
System.Data;
System.Data.SqlClient;
System.Data.SqlTypes;
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
view();
conection.Close();
}
protected void GridView1_RowDeleting1(object sender, GridViewDeleteEventArgs e)
{
conection.Open();
Label dynamiclbl = (Label)GridView1.Rows[e.RowIndex].FindControl("Label1");
SqlCommand cmd2 = new SqlCommand("delete from tbl_view where aoutoid='" +
dynamiclbl.Text + "'", conection);
cmd2.ExecuteNonQuery();
GridView1.EditIndex = -1;
view();
conection.Close();
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
view();
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void insert(string fname,string name)
{
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "insert")
{
TextBox txt_name = (TextBox)GridView1.FooterRow.FindControl("TextBox2");
TextBox txt_address = (TextBox)GridView1.FooterRow.FindControl("TextBox4");
TextBox txt_phone = (TextBox)GridView1.FooterRow.FindControl("TextBox6");
TextBox txt_city = (TextBox)GridView1.FooterRow.FindControl("TextBox_city1");
conection.Open();
SqlCommand cmd = new SqlCommand("insert into tbl_view(name,address,phone,city)
values('" + txt_name.Text + "','" + txt_address.Text + "','" + txt_phone.Text + "','" +
txt_city.Text + "')", conection);
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
view();
}
}