protected void Button_P1_Save_Click(object sender, EventArgs e) { if (Basic_Checks._Textbox_Not_Empty(TextBox_P1_Class, Label80, "*")) { SqlDataSource_Vehicle_Class_Id.Insert(); } GridView1.DataBind(); TextBox_P1_Class.Text = ""; TextBox_P1_Description.Text = ""; Panel10.Visible = true; Panel1.Visible = false; DropDownList_Vehicle_Class_Id.DataBind(); }
protected void Button_P1_Cancel_Click(object sender, EventArgs e) { Panel10.Visible = true; Panel1.Visible = false; DropDownList_Vehicle_Class_Id.DataBind(); }
protected void LinkButton3_Click(object sender, EventArgs e) { GridViewRow gv = (GridViewRow)(sender as Control).Parent.Parent; int i = gv.RowIndex; LinkButton LinkButton3 = (LinkButton)GridView5.Rows[i].FindControl("LinkButton3"); HiddenField HiddenField2 = (HiddenField)GridView5.Rows[i].FindControl("HiddenField2"); HiddenField_VehicleId_p10.Value = HiddenField2.Value; for (int lop = 0; lop < GridView5.Rows.Count; lop++) { LinkButton LinkButtona = (LinkButton)GridView5.Rows[lop].FindControl("LinkButton3"); LinkButtona.ForeColor = System.Drawing.Color.Blue; } LinkButton3.ForeColor = System.Drawing.Color.Red; { ////Fetch Data SqlConnection con = new SqlConnection(connection); SqlCommand cmd = new SqlCommand("Select_Vehicle_For_Update", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter v_id = new SqlParameter("@Vehicle_id", HiddenField_VehicleId_p10.Value); //cmd.Parameters.Add(v_id); //SqlDataReader r = cmd.ExecuteReader(new SqlParameter("@Vehicle_id", HiddenField_VehicleId_p10.Value)); cmd.Parameters.Add(new SqlParameter("@Vehicle_id", HiddenField_VehicleId_p10.Value)); con.Open(); SqlDataReader r = cmd.ExecuteReader(); if (r.Read()) { TextBox_Registration_Authority.Text = Convert.ToString(r["Registration_Authority"]); DropDownList_Vehicle_Class_Id.DataBind(); DropDownList_Vehicle_Class_Id.SelectedValue = Convert.ToString(r["Vehicle_Class_Id"]); DropDownList_Vehicle_Condition_Id.DataBind(); DropDownList_Vehicle_Condition_Id.SelectedValue = Convert.ToString(r["Vehicle_Condition_Id"]); DropDownList_ManufacturerId.DataBind(); DropDownList_ManufacturerId.SelectedValue = Convert.ToString(r["Maker_Name"]); Vehicle_Type_Id.DataBind(); Vehicle_Type_Id.SelectedValue = Convert.ToString(r["Vehicle_Type_Id"]); DropDownList_Vehicle_BodyTypeId.DataBind(); DropDownList_Vehicle_BodyTypeId.SelectedValue = Convert.ToString(r["Vehicle_BodyTypeId"]); TextBox_Manufacture_Year.Text = Convert.ToString(r["Manufacture_Year"]); DropDownList_ManufactureMonths.SelectedValue = Convert.ToString(r["Manufacture_Month"]); TextBox_NoOfCylinder.Text = Convert.ToString(r["NoOfCylinder"]); TextBox_HorsePower.Text = Convert.ToString(r["HorsePower"]); TextBox_CubicCapacity.Text = Convert.ToString(r["CubicCapacity"]); TextBox_ChassisNumber.Text = Convert.ToString(r["ChassisNumber"]); TextBox_EnginNo.Text = Convert.ToString(r["EnginNo"]); TextBox_SeatingCapcity.Text = Convert.ToString(r["SeatingCapcity"]); TextBox_UnLandedWeight.Text = Convert.ToString(r["UnLandedWeight"]); TextBox_Colour.Text = Convert.ToString(r["Colour"]); TextBox_Lenght.Text = Convert.ToString(r["Lenght"]); TextBox_Width.Text = Convert.ToString(r["Width"]); TextBox_Height.Text = Convert.ToString(r["Height"]); TextBox_InsuranceNumber.Text = Convert.ToString(r["InsuranceNumber"]); WebDateChooser_Insurance_FromDate.Text = Convert.ToString(r["Insurance_FromDate"]); HiddenField_Insurance_FromDate.Value = Convert.ToString(r["Insurance_FromDate"]); WebDateChooser_Insurance_ToDate.Text = Convert.ToString(r["Insurance_ToDate"]); HiddenField__Insurance_ToDate.Value = Convert.ToString(r["Insurance_ToDate"]); TextBox_Number.Text = Convert.ToString(r["Number"]); TextBox_RegistrationNo.Text = Convert.ToString(r["Registration_Number"]); WebDateChooser_PurchasedDate.Text = Convert.ToString(r["Purchased_Date"]); TextBox_Cost.Text = Convert.ToString(r["Cost"]); //= Convert.ToString(r["Date_Time"]); //= Convert.ToString(r["Emp_Id"]); } else { } con.Close(); CheckBoxList_Vehicle_FuelType.DataBind(); for (int ind = 0; ind < CheckBoxList_Vehicle_FuelType.Items.Count; ind++) { if (hasval(CheckBoxList_Vehicle_FuelType.Items[ind].Value)) { CheckBoxList_Vehicle_FuelType.Items[ind].Selected = true; //HiddenField_Vehicle_FuelType_Id.Value = CheckBoxList_Vehicle_FuelType.Items[i].Value; //string connection = Convert.ToString(ConfigurationManager.ConnectionStrings["TMSConnectionString"]); //string Qry = "INSERT INTO Vehicle_Fuel (Vehicle_FuelType_Id, Vehicle_id, Emp_Id) VALUES (" + CheckBoxList_Vehicle_FuelType.Items[i].Value + "," + HiddenField_Vehicle_id.Value+ ","+Session["Emp_Id"]+")"; //SqlConnection con = new SqlConnection(connection); //SqlCommand cmd = new SqlCommand(Qry, con); //con.Open(); //cmd.ExecuteNonQuery(); //con.Close(); //SqlDataSource_Vehicle_FuelType_Id.Insert(); } } //////Fetch Data } Button_Cancel_P10.Visible = true; Button_Update_P10.Visible = true; Button_Save.Visible = false; }