using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BuckshawObjects.Global; using BuckshawObjects.Objects; using DevExpress.Web.ASPxEditors; using System.IO; using DevExpress.Web.ASPxDataView; using System.Collections; using DevExpress.Web.ASPxGridView; using System.Data; using System.Data.SqlClient; using System.Configuration; using DevExpress.XtraRichEdit.API.Native; using System.Drawing; namespace Buckshaw.Backend { public partial class WebForm5 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } public void chkStatus_OnCheckedChanged(object sender, EventArgs e) { string constr = ConfigurationManager.ConnectionStrings["BuckshawHomesConnectionString"].ConnectionString; ASPxCheckBox chkStatus = (ASPxCheckBox)sender; //ASPxDataView row = (ASPxDataView)chkStatus.NamingContainer; DataViewItemTemplateContainer row=(DataViewItemTemplateContainer)chkStatus.NamingContainer; //string cid = row.Controls[0].ToString(); //string cod =(row.ItemIndex+1).ToString(); //string cod = row.ItemIndex.ToString(); //string cod = dataView.FindControl("HouseImageID").ToString(); //string cid = dataView.Controls[0].ToString(); //string cod = dataView.Items[0].DataItem.ToString(); string cid = row.EvalDataItem("HouseImageID").ToString(); //string cid = "True"; bool status = chkStatus.Checked; string query = "UPDATE [tblHouseImage] SET Active = @Approved WHERE HouseImageID = @HouseImageID"; //WHERE HouseImageID = @HouseImageID" SqlConnection con = new SqlConnection(constr); SqlCommand com = new SqlCommand(query, con); com.Parameters.AddWithValue("@Approved", status); com.Parameters.AddWithValue("@HouseImageID", cid); con.Open(); com.ExecuteNonQuery(); con.Close(); dataView.DataBind(); } } }
HouseImageId=666
HouseImageId
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)