protected void btnCancel_Click(object sender, EventArgs e) { TextBox_Manufacturer.Text = ""; TextBox_Location.Text = ""; TextBox_Phone.Text = ""; Panel10.Visible = true; DropDownList_ManufacturerId.DataBind(); Panel2.Visible = false; }
protected void Button_P2_Save_Click(object sender, EventArgs e) { //if (Basic_Checks._Textbox_Not_Empty(TextBox_Manufacturer, Label81, "*")) //{ SqlDataSource_Manufacturer.Insert(); //} GridView_P2_Manufacturer.DataBind(); TextBox_Manufacturer.Text = ""; TextBox_Location.Text = ""; TextBox_Phone.Text = ""; Panel10.Visible = true; DropDownList_ManufacturerId.DataBind(); Panel2.Visible = false; }
protected void DropDownList_Class_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList_Class.SelectedIndex == 0) { DropDownList_ManufacturerId.DataBind(); DropDownList_ManufacturerId.Items.Insert(0, "Select Manufacturer"); DropDownList_ManufacturerId.Items[0].Value = ""; DropDownList_ManufacturerId.SelectedIndex = 0; } else { DropDownList_ManufacturerId.DataBind(); DropDownList_ManufacturerId.Items.Insert(0, "Select Manufacturer"); DropDownList_ManufacturerId.Items[0].Value = ""; } }
protected void Button1_Click(object sender, EventArgs e) { TextBox_CC.Text = ""; TextBox_EnginNumber.Text = ""; TextBox_INumber.Text = ""; TextBox_RNumber.Text = ""; TextBox_Vnumber.Text = ""; DropDownList_Year.SelectedIndex = 0; DropDownList_Class.SelectedIndex = 0; DropDownList_Driver.SelectedIndex = 0; DropDownList_Officer.SelectedIndex = 0; DropDownList_ManufacturerId.DataBind(); DropDownList_ManufacturerId.Items.Insert(0, "Select Manufacturer"); DropDownList_ManufacturerId.Items[0].Value = ""; DropDownList_ManufacturerId.SelectedIndex = 0; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Int32 currentyear = Convert.ToInt32(DateTime.Now.Year); for (int i = 11; i >= 0; i--) { DataBind(); DropDownList_Year.Items.Insert(0, Convert.ToString(currentyear - i)); DropDownList_Year.Items[0].Value = Convert.ToString(currentyear - i); DataBind(); } DropDownList_Year.DataBind(); DropDownList_Year.Items.Insert(0, "Select Year"); DropDownList_Year.Items[0].Value = ""; DropDownList_Year.SelectedIndex = 0; DropDownList_Class.DataBind(); DropDownList_Class.Items.Insert(0, "Select Class"); DropDownList_Class.Items[0].Value = ""; DropDownList_Class.SelectedIndex = 0; DropDownList_Driver.DataBind(); DropDownList_Driver.Items.Insert(0, "Select Driver"); DropDownList_Driver.Items[0].Value = ""; DropDownList_Driver.SelectedIndex = 0; DropDownList_Officer.DataBind(); DropDownList_Officer.Items.Insert(0, "Select Officer"); DropDownList_Officer.Items[0].Value = ""; DropDownList_Officer.SelectedIndex = 0; DropDownList_ManufacturerId.DataBind(); DropDownList_ManufacturerId.Items.Insert(0, "Select Manufacturer"); DropDownList_ManufacturerId.Items[0].Value = ""; DropDownList_ManufacturerId.SelectedIndex = 0; } }
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; }