protected void Button_Cancel_P10_Click(object sender, EventArgs e) { Button_Cancel_P10.Visible = false; Button_Update_P10.Visible = false; Button_Save.Visible = true; for (int lop = 0; lop < GridView5.Rows.Count; lop++) { LinkButton LinkButtona = (LinkButton)GridView5.Rows[lop].FindControl("LinkButton3"); LinkButtona.ForeColor = System.Drawing.Color.Blue; } HiddenField_VehicleId_p10.Value = "0"; TextBox_ChassisNumber.Text = ""; TextBox_Colour.Text = ""; TextBox_CubicCapacity.Text = ""; TextBox_EnginNo.Text = ""; TextBox_Height.Text = ""; TextBox_HorsePower.Text = ""; TextBox_InsuranceNumber.Text = ""; TextBox_Lenght.Text = ""; //TextBox_Maker_Name.Text = ""; DropDownList_ManufactureMonths.DataBind(); DropDownList_ManufactureMonths.Items.Insert(0, ""); DropDownList_ManufactureMonths.Items[0].Value = ""; TextBox_Manufacture_Year.Text = ""; TextBox_NoOfCylinder.Text = ""; // TextBox_OwnerName.Text = ""; TextBox_Registration_Authority.Text = ""; TextBox_SeatingCapcity.Text = ""; TextBox_UnLandedWeight.Text = ""; TextBox_Width.Text = ""; TextBox_Number.Text = ""; TextBox_Cost.Text = ""; TextBox_RegistrationNo.Text = ""; CheckBoxList_Vehicle_FuelType.DataBind(); }
protected void Button_Update_P10_Click(object sender, EventArgs e) { if (HiddenField_VehicleId_p10.Value != "0") { //HiddenField_Insurance_FromDate.Value = Convert.ToString(WebDateChooser_Insurance_FromDate.Value); //HiddenField__Insurance_ToDate.Value = Convert.ToString(WebDateChooser_Insurance_ToDate.Value); //HiddenField_Insurance_FromDate.Value = Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["WebDateChooser_Insurance_FromDate"]).Value)); //HiddenField__Insurance_ToDate.Value = Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["WebDateChooser_Insurance_ToDate"]).Value)); if (TextBox_Number.Text != "") { if (TextBox_InsuranceNumber.Text == "") { HiddenField__Insurance_ToDate.Value = ""; HiddenField_Insurance_FromDate.Value = ""; } SqlDataSource_Save0.Insert(); for (int i = 0; i < CheckBoxList_Vehicle_FuelType.Items.Count; i++) { if (CheckBoxList_Vehicle_FuelType.Items[i].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_Id0.Insert(); } } } TextBox_ChassisNumber.Text = ""; TextBox_Colour.Text = ""; TextBox_CubicCapacity.Text = ""; TextBox_EnginNo.Text = ""; TextBox_Height.Text = ""; TextBox_HorsePower.Text = ""; TextBox_InsuranceNumber.Text = ""; TextBox_Lenght.Text = ""; //TextBox_Maker_Name.Text = ""; DropDownList_ManufactureMonths.DataBind(); DropDownList_ManufactureMonths.Items.Insert(0, ""); DropDownList_ManufactureMonths.Items[0].Value = ""; TextBox_Manufacture_Year.Text = ""; TextBox_NoOfCylinder.Text = ""; // TextBox_OwnerName.Text = ""; TextBox_Registration_Authority.Text = ""; TextBox_SeatingCapcity.Text = ""; TextBox_UnLandedWeight.Text = ""; TextBox_Width.Text = ""; TextBox_Number.Text = ""; TextBox_Cost.Text = ""; TextBox_RegistrationNo.Text = ""; GridView5.DataBind(); CheckBoxList_Vehicle_FuelType.DataBind(); Button_Cancel_P10.Visible = false; Button_Update_P10.Visible = false; Button_Save.Visible = true; for (int lop = 0; lop < GridView5.Rows.Count; lop++) { LinkButton LinkButtona = (LinkButton)GridView5.Rows[lop].FindControl("LinkButton3"); LinkButtona.ForeColor = System.Drawing.Color.Blue; } } }