Hi guys
I have a aspx page ajax enabled and using update panels, ModalpopupExtenders
and on one of my ModalPopupextenders either one or more user controls are
called up into the displayed panel of the Modalpopup.
It loads only the controls that are assigned, to do this I assign the controls via
the repeaters OnItemDataBound event:
ok so now i have my user control to capture.Code:Protected Sub rpActiveSpecification_OnItemDataBound(ByVal s As Object, ByVal e As RepeaterItemEventArgs) If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then '--------------------------------------- Dim myForms As Forms = e.Item.DataItem Dim pnlActiveSpecificationForms As Panel = e.Item.FindControl("pnlActiveSpecificationForms") ViewState("FormsArt") = "".ToString ViewState("FormsCarpetRug") = "".ToString ViewState("FormsAccessories") = "".ToString ViewState("FormsBedding") = "".ToString ViewState("FormsCasegoods") = "".ToString ViewState("FormsDrapery") = "".ToString ViewState("FormsFabric") = "".ToString ViewState("FormsLighting") = "".ToString ViewState("FormsMirrors") = "".ToString ViewState("FormsPillow") = "".ToString ViewState("FormsTrims") = "".ToString ViewState("FormsUpholstered") = "".ToString ViewState("FormsArchitectschedule") = "".ToString '--------------------------------------- Select Case myForms.Name Case "Art" FormsArt = CType(LoadControl("~/CustomControls/FormControls/form_art.ascx"), ASP.customcontrols_formcontrols_form_art_ascx) pnlActiveSpecificationForms.Controls.Add(FormsArt) FormsArt.SpecID = myParams.SpecID ViewState("FormsArt") = "~/CustomControls/FormControls/form_art.ascx".ToString Case "Carpet Rug" FormsCarpetRug = CType(LoadControl("~/CustomControls/FormControls/form_carpetrug.ascx"), ASP.customcontrols_formcontrols_form_carpetrug_ascx) pnlActiveSpecificationForms.Controls.Add(FormsCarpetRug) FormsCarpetRug.SpecID = myParams.SpecID ViewState("FormsCarpetRug") = "~/CustomControls/FormControls/form_carpetrug.ascx".ToString Case "Accessories" FormsAccessories = CType(LoadControl("~/CustomControls/FormControls/form_accessories.ascx"), ASP.customcontrols_formcontrols_form_accessories_ascx) pnlActiveSpecificationForms.Controls.Add(FormsAccessories) FormsAccessories.SpecID = myParams.SpecID ViewState("FormsAccessories") = "~/CustomControls/FormControls/form_accessories.ascx".ToString Case "Bedding" FormsBedding = CType(LoadControl("~/CustomControls/FormControls/form_bedding.ascx"), ASP.customcontrols_formcontrols_form_bedding_ascx) pnlActiveSpecificationForms.Controls.Add(FormsBedding) FormsBedding.SpecID = myParams.SpecID ViewState("FormsBedding") = "~/CustomControls/FormControls/form_bedding.ascx".ToString Case "Casegoods" FormsCasegoods = CType(LoadControl("~/CustomControls/FormControls/form_casegoods.ascx"), ASP.customcontrols_formcontrols_form_casegoods_ascx) pnlActiveSpecificationForms.Controls.Add(FormsCasegoods) FormsCasegoods.SpecID = myParams.SpecID ViewState("FormsCasegoods") = "~/CustomControls/FormControls/form_casegoods.ascx".ToString Case "Drapery" FormsDrapery = CType(LoadControl("~/CustomControls/FormControls/form_drapery.ascx"), ASP.customcontrols_formcontrols_form_drapery_ascx) pnlActiveSpecificationForms.Controls.Add(FormsDrapery) FormsDrapery.SpecID = myParams.SpecID ViewState("FormsDrapery") = "~/CustomControls/FormControls/form_drapery.ascx".ToString Case "Fabric" FormsFabric = CType(LoadControl("~/CustomControls/FormControls/form_fabric.ascx"), ASP.customcontrols_formcontrols_form_fabric_ascx) pnlActiveSpecificationForms.Controls.Add(FormsFabric) FormsFabric.SpecID = myParams.SpecID ViewState("FormsFabric") = "~/CustomControls/FormControls/form_fabric.ascx".ToString Case "Lighting" FormsLighting = CType(LoadControl("~/CustomControls/FormControls/form_lighting.ascx"), ASP.customcontrols_formcontrols_form_lighting_ascx) pnlActiveSpecificationForms.Controls.Add(FormsLighting) FormsLighting.SpecID = myParams.SpecID ViewState("FormsLighting") = "~/CustomControls/FormControls/form_lighting.ascx".ToString Case "Mirrors" FormsMirrors = CType(LoadControl("~/CustomControls/FormControls/form_mirrors.ascx"), ASP.customcontrols_formcontrols_form_mirrors_ascx) pnlActiveSpecificationForms.Controls.Add(FormsMirrors) FormsMirrors.SpecID = myParams.SpecID ViewState("FormsMirrors") = "~/CustomControls/FormControls/form_mirrors.ascx".ToString Case "Pillow" FormsPillow = CType(LoadControl("~/CustomControls/FormControls/form_pillow.ascx"), ASP.customcontrols_formcontrols_form_pillow_ascx) pnlActiveSpecificationForms.Controls.Add(FormsPillow) FormsPillow.SpecID = myParams.SpecID ViewState("FormsPillow") = "~/CustomControls/FormControls/form_pillow.ascx".ToString Case "Trims" FormsTrims = CType(LoadControl("~/CustomControls/FormControls/form_trims.ascx"), ASP.customcontrols_formcontrols_form_trims_ascx) pnlActiveSpecificationForms.Controls.Add(FormsTrims) FormsTrims.SpecID = myParams.SpecID ViewState("FormsTrims") = "~/CustomControls/FormControls/form_trims.ascx".ToString Case "Uplholstered" FormsUpholstered = CType(LoadControl("~/CustomControls/FormControls/form_upholstereditems.ascx"), ASP.customcontrols_formcontrols_from_upholstereditems_ascx) pnlActiveSpecificationForms.Controls.Add(FormsUpholstered) FormsUpholstered.SpecID = myParams.SpecID ViewState("FormsUpholstered") = "~/CustomControls/FormControls/form_upholstereditems.ascx".ToString Case "Architectural Schedule" FormsArchitectschedule = CType(LoadControl("~/CustomControls/FormControls/form_architectschedule.ascx"), ASP.customcontrols_formcontrols_form_architectschedule_ascx) pnlActiveSpecificationForms.Controls.Add(FormsArchitectschedule) FormsArchitectschedule.SpecID = myParams.SpecID ViewState("FormsArchitectschedule") = "~/CustomControls/FormControls/form_architectschedule.ascx".ToString End Select End If End Sub
when i hit my update button, which resides in the display panel of the
ModalPopup, not in the user control, so when the update button is clicked
I call another sub which reloads the control(this is due to the controls being dynamically added) and calls the update function of that control:
and here is the update function of the user control:Code:Public Sub btnActiveSpecificationUpdate_OnClick(ByVal s As Object, ByVal e As EventArgs) Dim myButton As Button = s '--------------------------------------- 'decalre Dim pnlActiveSpecification As Panel = myButton.Parent If CType(ViewState("FormsArt"), String) > "" Then FormsArt = CType(LoadControl("~/CustomControls/FormControls/form_art.ascx"), ASP.customcontrols_formcontrols_form_art_ascx) FormsArt.Update_Form() End If End Sub
but nothing get's passed, all the input fields from the user control are empty?Code:Public Sub Update_Form() Dim myArt As Art = New Art Dim fieldlist As New ArrayList '--------------------------------------- 'get all data myArt = ArtManager.GetItem(SpecID) '--------------------------------------- 'check to see if something has been updated If txtArt_material.Text <> myArt.Material Then fieldlist.Add("material") myArt.Material = txtArt_material.Text End If If txtArt_colour.Text <> myArt.Colour Then fieldlist.Add("colour") myArt.Colour = txtArt_colour.Text End If If txtArt_supplierref.Text <> myArt.SupplierRef Then fieldlist.Add("supplierref") myArt.SupplierRef = txtArt_supplierref.Text End If If txtArt_finish.Text <> myArt.Finish Then fieldlist.Add("finish") myArt.Finish = txtArt_finish.Text End If If txtArt_width.Text <> myArt.Width Then fieldlist.Add("width") myArt.Width = txtArt_width.Text End If If txtArt_height.Text <> myArt.Height Then fieldlist.Add("height") myArt.Height = txtArt_height.Text End If If txtArt_framewidth.Text <> myArt.FrameWidth Then fieldlist.Add("framewidth") myArt.FrameWidth = txtArt_framewidth.Text End If If txtArt_innerframe.Text <> myArt.InnerFrame Then fieldlist.Add("innerframe") myArt.InnerFrame = txtArt_innerframe.Text End If If txtArt_glassthickness.Text <> myArt.GlassThickness Then fieldlist.Add("glassthickness") myArt.GlassThickness = txtArt_glassthickness.Text End If If txtArt_hangingrequirements.Text <> myArt.HangingRequirements Then fieldlist.Add("hangingrequirements") myArt.HangingRequirements = txtArt_hangingrequirements.Text End If myArt.SpecID = SpecID '--------------------------------------- 'check to see if any records need to be updated, if so, update them If Not fieldlist.Count = 0 Then ArtManager.Update(myArt) fieldlist.RemoveRange(0, fieldlist.Count) End If End Sub
any ideas here?
Shem



LinkBack URL
About LinkBacks
Reply With Quote



Bookmarks