protected void FvInspectionIternary_DataBound(object sender, EventArgs e) { string Mode = String.Empty; switch (FvInspectionIternary.CurrentMode) { case FormViewMode.Edit: Mode = "Upd"; break; case FormViewMode.Insert: Mode = "Ins"; break; case FormViewMode.ReadOnly: Mode = "Itm"; break; default: break; } // Get the Yearly Schedule Id Guid ScheduleId = new Guid(fldScheduleId.Value); // Get the Monthly schedule details for the selected Schedule Inspection objInspection = new Inspection(); DataTable dtScheduleDetails = objInspection.GetYearlyInspectionDetailsById(ScheduleId); DropDownList ddlInspectionMonth = ((DropDownList)FvInspectionIternary.FindControl("ddlMonth" + Mode)); GvInspectionDetails.DataSource = dtScheduleDetails; GvInspectionDetails.DataBind(); if (dtScheduleDetails.Rows.Count > 0) { //int year= (int)dtScheduleDetails.Rows[0]["Year"]; //Label lblYear = (Label)FvInspectionIternary.FindControl("lblYear" + Mode); //if (lblYear != null) // lblYear.Text = Convert.ToString(year); //PopCalendar popInspectingDate = (PopCalendar)FvInspectionIternary.FindControl("popInspectingDate" + Mode); //RangeFrom DateFrom = new RangeFrom(); //RangeTo DateTo = new RangeTo(); //DateFrom.Date = new DateTime(year, ddlInspectionMonth.SelectedIndex, 01); //DateTo.Date = new DateTime(year, ddlInspectionMonth.SelectedIndex, DateTime.DaysInMonth(year, ddlInspectionMonth.SelectedIndex)); //if (popInspectingDate != null){ //popInspectingDate.From = DateFrom; //popInspectingDate.To = DateTo; //} ddlInspectionMonth.SelectedIndex = Convert.ToInt32(dtScheduleDetails.Rows[0]["Month"]); } }
protected void GvInspectionDetailsIns_SelectedIndexChanged(object sender, EventArgs e) { ViewState["ScheculeId"] = GvYearlyInspection.SelectedDataKey.Value.ToString(); fldScheduleId.Value = ViewState["ScheculeId"].ToString(); if (Request.Params["Mode"] != null) { switch (Request.Params["Mode"]) { case "InspectionItenaryDe": MvInspectionIternary.SetActiveView(MvInspectionIternary.Views[0]); FvInspectionItenaryReadOnly.ChangeMode(FormViewMode.ReadOnly); break; case "InspectionItenary": MvInspectionIternary.SetActiveView(MvInspectionIternary.Views[0]); FvInspectionIternary.ChangeMode(FormViewMode.ReadOnly); break; } } }