public static Fixname[] editfixname(string ID) { string s = ""; List <Fixname> objf = new List <Fixname>(); Fixname objfix = new Fixname(); if (HttpContext.Current.Session["User_ID"] != null && HttpContext.Current.Session["User_ID"].ToString() != "") { SqlDataAdapter da = new SqlDataAdapter("select * from FixtureName where FID='" + Convert.ToInt32(ID) + "'", strConnString); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { objfix = new Fixname(); objfix.fixname = ds.Tables[0].Rows[i]["Fixturename"].ToString(); objfix.partno = ds.Tables[0].Rows[i]["Partnumber"].ToString(); objfix.fid = ds.Tables[0].Rows[i]["FID"].ToString(); objfix.unit = ds.Tables[0].Rows[i]["Unit"].ToString(); objfix.line = ds.Tables[0].Rows[i]["Line"].ToString(); objfix.model = ds.Tables[0].Rows[i]["Model"].ToString(); objfix.type = ds.Tables[0].Rows[i]["Type"].ToString(); objfix.fixtureno = ds.Tables[0].Rows[i]["Fixtrue"].ToString(); objfix.cell = ds.Tables[0].Rows[i]["Cell"].ToString(); objf.Add(objfix); splitpartno = ds.Tables[0].Rows[i]["Partnumber"].ToString(); } //check(splitpartno); // string[] spltpartno = spltpart.Split(','); //for (int i = 0; i < splitpartno.Length; i++) //{ // GridViewRow row = GridView2.Rows[e.RowIndex]; // String courseNo = splitpartno[i].Trim(); // //System.Diagnostics.Debug.Print("Course No :"+courseNo+"\n"); // for (int j = 0; j < row.Count; j++) // { // //System.Diagnostics.Debug.Print("Row Value = " + gridview_modules.Rows[j].Cells[1].ToString() + "List value = " + courseNo + "\n"); // //if (row.Rows[j].Cells[1].Text == courseNo) // //{ // // var chk = (System.Web.UI.WebControls.CheckBox)(row.Rows[j].Cells[0].FindControl("CheckBox2")); // // chk.Checked = true; // //} // } //} } else { } } else { HttpContext.Current.Response.Redirect("../Home.aspx", false); HttpContext.Current.ApplicationInstance.CompleteRequest(); } return(objf.ToArray()); }
protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e) { string s = ""; List <Fixname> objf = new List <Fixname>(); Fixname objfix = new Fixname(); if (HttpContext.Current.Session["User_ID"] != null && HttpContext.Current.Session["User_ID"].ToString() != "") { SqlDataAdapter da = new SqlDataAdapter("select * from FixtureName where FID='" + Convert.ToInt32(ID) + "'", strConnString); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { objfix = new Fixname(); objfix.fixname = ds.Tables[0].Rows[i]["Fixturename"].ToString(); objfix.partno = ds.Tables[0].Rows[i]["Partnumber"].ToString(); objfix.fid = ds.Tables[0].Rows[i]["FID"].ToString(); objfix.unit = ds.Tables[0].Rows[i]["Unit"].ToString(); objfix.line = ds.Tables[0].Rows[i]["Line"].ToString(); objfix.model = ds.Tables[0].Rows[i]["Model"].ToString(); objfix.type = ds.Tables[0].Rows[i]["Type"].ToString(); objfix.fixtureno = ds.Tables[0].Rows[i]["Fixtrue"].ToString(); objfix.cell = ds.Tables[0].Rows[i]["Cell"].ToString(); objf.Add(objfix); splitpartno = ds.Tables[0].Rows[i]["Partnumber"].ToString(); } // string[] splitpartno1 = splitpartno; //for (int i = 0; i < splitpartno1.Length; i++) //{ GridViewRow row = GridView2.Rows[e.RowIndex]; String courseNo = splitpartno;//splitpartno1[i].Trim(); //System.Diagnostics.Debug.Print("Course No :"+courseNo+"\n"); for (int j = 0; j < GridView2.Rows.Count; j++) { //System.Diagnostics.Debug.Print("Row Value = " + gridview_modules.Rows[j].Cells[1].ToString() + "List value = " + courseNo + "\n"); //if (row.Rows[j].Cells[1].Text == courseNo) //{ // var chk = (System.Web.UI.WebControls.CheckBox)(row.Rows[j].Cells[0].FindControl("CheckBox2")); // chk.Checked = true; //} } //} } } else { Response.Redirect("~/Home.aspx"); } }