protected void ddlOrderItems_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddlOrderItems = (DropDownList)sender; Broker.DataAccess.OrderItem oi = Broker.DataAccess.OrderItem.Get(Convert.ToInt32(ddlOrderItems.SelectedValue)); if (oi != null) { ObjectDataSource odsInusranceType = DetailsViewOfferItems.FindControl("odsInsuranceTypes") as ObjectDataSource; odsInusranceType.SelectParameters.Clear(); odsInusranceType.SelectParameters.Add("orderItemID", ddlOrderItems.SelectedValue); ObjectDataSource odsInusranceSubType = DetailsViewOfferItems.FindControl("odsInsuranceSubTypes") as ObjectDataSource; odsInusranceSubType.SelectParameters.Clear(); odsInusranceSubType.SelectParameters.Add("orderItemID", oi.ID.ToString()); odsInusranceSubType.SelectParameters.Add("insuranceTypeID", oi.InsuranceSubType.InsuranceTypeID.ToString()); //FakeBind(false, false, true, false); //ddlInsuranceSubTypes.SelectedValue = oi.InsuranceSubTypeID.ToString(); //FakeBind(false, true, true, false); //DropDownList ddlInsuranceSubTypes = (DropDownList)DetailsViewOfferItems.FindControl("ddlInsuranceSubTypes"); //FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceSubTypes); //ddlInsuranceSubTypes.DataBind(); FakeBind(true, true, false, false); DropDownList ddlInsuranceCompanies = (DropDownList)DetailsViewOfferItems.FindControl("ddlInsuranceCompanies"); FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceCompanies); ddlInsuranceCompanies.DataBind(); } }
protected void FakeBind(bool isddlInsuranceTypesForChange, bool isddlInsuranceSubTypesForChange, bool isddlDealsForChange, bool isddlBrokeragesForChange) { if (isddlInsuranceTypesForChange) { DropDownList ddlInsuranceTypes = (DropDownList)DetailsViewOfferItems.FindControl("ddlInsuranceTypes"); //FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceSubTypes); ddlInsuranceTypes.DataBind(); } if (isddlInsuranceSubTypesForChange) { DropDownList ddlInsuranceSubTypes = (DropDownList)DetailsViewOfferItems.FindControl("ddlInsuranceSubTypes"); FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceSubTypes); ddlInsuranceSubTypes.DataBind(); } if (isddlDealsForChange) { DropDownList ddlDeals = (DropDownList)DetailsViewOfferItems.FindControl("ddlDeals"); FakeBinder.SimulateBindingContext(this.Page, ddlDeals); ddlDeals.DataBind(); } if (isddlBrokeragesForChange) { //DropDownList ddlBrokerages = (DropDownList)DetailsViewOfferItems.FindControl("ddlBrokerages"); //FakeBinder.SimulateBindingContext(this.Page, ddlBrokerages); //ddlBrokerages.DataBind(); } }
protected void ddlInsuranceCompanyIndexChanged(object sender, EventArgs e) { DropDownList ddlInsuranceSubTypes = DetailsView1.FindControl("ddlInsuranceSubTypes") as DropDownList; FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceSubTypes); ddlInsuranceSubTypes.DataBind(); }
protected void ddlInsuranceSubTypes_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddlInsuranceSubTypes = (DropDownList)sender; //FakeBind(false, false, true, false); DropDownList ddlInsuranceCompanies = (DropDownList)DetailsViewOfferItems.FindControl("ddlInsuranceCompanies"); FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceCompanies); ddlInsuranceCompanies.DataBind(); }
protected void btnNewOfferItem_Click(object sender, EventArgs e) { int offerID = 0; if (GXGridView1.SelectedValue != null) { offerID = Convert.ToInt32(GXGridView1.SelectedDataKey.Value); } else { offerID = GXGridView1SelectedValue; } Offer o = Offer.Get(offerID); if (o.OrderID != null) { TextBox tbOrderNumber = DetailsViewOfferItems.FindControl("tbOrderNumber") as TextBox; tbOrderNumber.Text = o.Order.OrderNumber; DropDownList ddlOrderItems = DetailsViewOfferItems.FindControl("ddlOrderItems") as DropDownList; ddlOrderItems.DataBind(); Broker.DataAccess.OrderItem orderItem = Broker.DataAccess.OrderItem.Get(int.Parse(ddlOrderItems.SelectedValue)); List <Broker.DataAccess.OrderItem> oItemList = Broker.DataAccess.OrderItem.GetByOrderID((int)o.OrderID); if (oItemList.Count > 0) { // ControlCollection c = DetailsViewOfferItems.Controls; ObjectDataSource odsInusranceType = DetailsViewOfferItems.FindControl("odsInsuranceTypes") as ObjectDataSource; odsInusranceType.SelectParameters.Clear(); odsInusranceType.SelectParameters.Add("orderItemID", orderItem.ID.ToString()); ObjectDataSource odsInusranceSubType = DetailsViewOfferItems.FindControl("odsInsuranceSubTypes") as ObjectDataSource; odsInusranceSubType.SelectParameters.Clear(); odsInusranceSubType.SelectParameters.Add("orderItemID", orderItem.ID.ToString()); odsInusranceSubType.SelectParameters.Add("insuranceTypeID", orderItem.InsuranceSubType.InsuranceTypeID.ToString()); FakeBind(true, false, false, false); FakeBind(false, true, false, false); DropDownList ddlInsuranceCompanies = (DropDownList)DetailsViewOfferItems.FindControl("ddlInsuranceCompanies"); FakeBinder.SimulateBindingContext(this.Page, ddlInsuranceCompanies); ddlInsuranceCompanies.DataBind(); mvOfferItems.SetActiveView(viewOfferItemsEdit); DetailsViewOfferItems.ChangeMode(DetailsViewMode.Insert); } } else { mvOfferItems.SetActiveView(viewOfferItemsEdit); DetailsViewOfferItems.ChangeMode(DetailsViewMode.Insert); // TextBox tbOfferNumber = (TextBox)DetailsViewOfferItems.FindControl("tbOfferNumber"); // tbOfferNumber.Text = Offer.Get(Convert.ToInt32(GXGridView1.SelectedDataKey.Value)).OfferNumber; } }