hi my problem is
my table contain these fields and each row contain one checkbox and this name is pros table
businessname status
------------ --------
electronic active
rise inactive
cooler active
if i check where status =inactive those rows will be moved to another table that is non live pros table and those checked rows will be deleted in first table and those rows will be placed in second table
please solve this one using gridviews(web application)
and i write one application but that application will give only inactive items
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("user id=bhanu;password=bhanu@123;database=EMS;server=server\\mit");
SqlDataAdapter da = new SqlDataAdapter("select * from pros", con);
DataSet ds = new DataSet();
da.Fill(ds, "pros");
GridView1.DataSource = ds.Tables["pros"];
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
//SqlConnection con1 = new SqlConnection("user id=bhanu;password=bhanu@123;database=EMS;server=server\\mit");
//SqlDataAdapter da1=new SqlDataAdapter("select * from pros where status='inactive'",con1);
//DataSet ds1=new DataSet();
//da1.Fill(ds1,"pros");
//GridView2.DataSource=ds1.Tables["pros"];
//GridView2.DataBind();
so please check and give me the code for my requirement............but i am not writing checked ones...please give me that one also
Loading

Posted Jun 7, 2011, 6:25 AM
{
CheckBox chk = (CheckBox) row.FindControl("CheckboxName");
if (chk.Checked)
//take the id of the row here.
int ID = ....;
create DB COnnection pass id to query to delete it
delete from proc where id = ID.
Command.ExecuteNonQuery()....
}
bhanu prasannakumarPosted Jun 7, 2011, 6:08 AM
Posted Jun 7, 2011, 4:57 AM
If you want to delete records from DB also, please iterate the gridviewrows and delete it.
foreach(GridViewRow row in GridView.Rows)
{
CheckBox chk = (CheckBox) row.FindControl("CheckboxName");
if (chk.Checked)
//take the id of the row here.
int ID = ....;
create DB COnnection pass id to query to delete it
delete from proc where id = ID.
Command.ExecuteNonQuery()....
}
bhanu prasannakumarPosted Jun 7, 2011, 4:52 AM
but one doubt is if i click those inactive rows and press the button those will be moved to another table those are non live table...and change in database also...how can i ...
Posted Jun 7, 2011, 4:21 AM
select * from pros where status ='active' and bind the grid1.
otherwise you can filter the records from datagridview and do
datatable.select ("status='active'"); this will return the array of reocords... this you can bind with grid.
bhanu prasannakumarPosted Jun 7, 2011, 3:59 AM
Posted Jun 7, 2011, 3:17 AM