using System;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.Web;
public partial class Venderview : System.Web.UI.Page
{
string strConn = ConfigurationManager.ConnectionStrings["connect"].ConnectionString;
DataSet objUserDs = new DataSet();
SqlDataAdapter objUserDa;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SqlConnection con = new SqlConnection(strConn);
con.Open();
SqlCommand objUserCmd = new SqlCommand("select * from Asset_Vendor", con);
objUserDa = new SqlDataAdapter(objUserCmd);
objUserDa.Fill(objUserDs);
grdVendoradd.DataSource=objUserDs;
DataBind();
}
}
protected void btnAdd_Click(object sender, EventArgs e)
{
Response.Redirect("VendorAdd.aspx");
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
String str = Request.Form["rdoUser"];
Response.Redirect("Vendor_Update.aspx?Vendor_Id=" + str);
}
protected void btnDelete_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConn);
con.Open();
String str = Request.Form["rdoUser"];
SqlCommand objUserCmd = new SqlCommand("delete from Asset_Vendor where Vendor_Id=@vid", con);
SqlParameter paramUid = new SqlParameter("@vid", SqlDbType.VarChar, 50);
paramUid.Value = str;
objUserCmd.Parameters.Add(paramUid);
objUserCmd.ExecuteNonQuery();
Response.Redirect("Vender_view.aspx");
}
}
my question is instead of delete i want to update the status...in gridview page?
Loading

mohammed shamsheerPosted Feb 21, 2012, 12:07 AM
what i did is
first upall i want to say "i am a begginer"
1. i created status column in db
2. i have 'insert form' in that i passed active label to db
3 i created 'gridview form' there update button is created and i want to pass
inactive string to db when the update button is clicked.
4. Then i plan to create drop down list a display active and inactive user....u have any idea karthi
karthik vPosted Feb 20, 2012, 2:51 PM
I am not sure of the columns you have in the database table.But if you have a column with the status then what you could do you could drop in a value in that column as (0) when ever user wants to delete a row .So when you are repopulating the values form the database then you could write in the Select statement something like this
select * from Asset_Vendor where Status=1.
In this way you will have the deleted values in the database but not in your gridview.
I hope this helps .
Let me know if you have any questions .