locked
multiple usercontrols issue RRS feed

  • Question

  • User1094877758 posted

    On a user control, I have a dropdown list (ddlCriteria), a listbox, a modal popup (mpeCriteria) that has a checkbox list (chkCriteria), and a dropdown list that filters (ddlFilterCriteria) the checkbox list.  I have added this user control twice on the main aspx page. 

     The page loads with two user controls having two different criteria.  A user can decide to select criteria by choosing the selection option from ddlCriteria, which opens the modal popup.  From the modal popup, the user can use ddlFilterCriteria to choose a specific criteria or browse through chkCriteria.  After choosing criteria and clicking on the submit button, ddlCriteria is set to invisible and the listbox appears with the chosen criteria. 

    The issue is that when the user chooses to use ddlFilterCriteria and select a criteria, after clicking the submit button, ddlCriteria on the second usercontrol is hidden/invisible.  However, if the user chooses criteria from chkCriteria and then clicks submit, then ddlCriteria in the second user control doesn't become hidden/invisible.

    Any suggestions on how to resolve this?  Thanks.

    Tuesday, July 22, 2008 12:32 PM

Answers

  • User-16411453 posted

     When making controls that can be loaded many times on the same page, you have to ID the main objects using the builtin property ID.  In vb it's [ID], don't know what it is in CS. This is the < id="controName" runat-"server" /> in the controls webform tag

     

    ibBasic = New ImageButton
    With ibBasic
    .ID = [ID] & "_ibBasic"
    .AlternateText = "Basic"
    .ImageAlign = ImageAlign.AbsBottom
    .ImageUrl = cs.GetWebResourceUrl(rsType, "ibBasic.gif")
    .ToolTip = "Assign Basic Information to your Product or Item"
    .CausesValidation = False
    .ValidationGroup = "_Basic"
    End With
    AddHandler
    ibBasic.Click, AddressOf ibBasic_Click
    tdTabs.Controls.Add(ibBasic)
      
    Dim ibBasic_Trigger As AsyncPostBackTrigger
    ibBasic_Trigger = New AsyncPostBackTrigger
    With ibBasic_Trigger
    .EventName = "Click"
    .ControlID = [ID] & "_ibBasic"
    End With
    UpdatePanel_ProductEditor.Triggers.Add(ibBasic_Trigger)
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 22, 2008 7:48 PM