Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

WebCombo Event problem in Repeater control

Last post 07-23-2008 15:36 by fender. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-23-2008 11:00

    • fender
    • Not Ranked
    • Joined on 01-28-2008
    • Points 80

    WebCombo Event problem in Repeater control

    Hi Guys.

    Am I missing something here? I have a WebCombo inside a Repeater control and in the Repeaters ItemDataBound Event I am adding 2 handlers.

    Dim colourCombo As Infragistics.WebUI.WebCombo.WebCombo = CType(e.Item.FindControl("wcmbAssocColours"), Infragistics.WebUI.WebCombo.WebCombo)

    AddHandler colourCombo.SelectedRowChanged, AddressOf wcmbAssocColours_SelectedRowChanged

    AddHandler colourCombo.InitializeLayout, AddressOf wcmbColours_InitializeLayout

    The InitializeLayout event triggers OK, but the SelectedRowChanged event doesn't trigger at all even though it is Posting back.

    Any ideas?

    Andy.

     

    • Post Points: 20
  • 07-23-2008 13:57 In reply to

    Re: WebCombo Event problem in Repeater control

    Hello Andy,

    Thanks for writing. From what I see in the code you have pasted, everything seems perfect and is a good approach. Is it possible that something in the ASPX setup is missing? For example, have you set the AutoPostBack property of the combobox to true? If you paste your Repeater ItemTemplate with the combobox inside, this will certainly provide additional clues.

    I also have one additional suggestion.- you can hook the event handlers directly on the combobox declaration, e.g.

    ...

    <ItemTemplate>

        <igcmb:combobox runat="server" ID="..." OnSelectedRowChanged="..."  OnInitializeLayout="..."
     

    </ItemTemplate> 

    ... 

    Best Regards,
    Rumen Stankov (MCSD.NET)
    The Infragistics ASP.NET Team
    • Post Points: 20
  • 07-23-2008 15:03 In reply to

    • fender
    • Not Ranked
    • Joined on 01-28-2008
    • Points 80

    Re: WebCombo Event problem in Repeater control

    Hi Rumen.

    Thanks for replying.

    Your sugestion to hook the handler in the aspx declaration works a treat.

     <igcmbo:WebCombo ID="wcmbAssocColours" runat="server" OnSelectedRowChanged="wcmbAssocColours_SelectedRowChanged"

    But I can't figure out why adding the handler in the Repeaters ItemDataBound event works for the InitializeLayout event but not the SelectedRowChanged event even though it is causing a postback. I have used this approach many times without issue.

    Anyway, many, many thanks for your help.

    Andy.

    • Post Points: 20
  • 07-23-2008 15:12 In reply to

    Re: WebCombo Event problem in Repeater control

    Hello Andy,

    Glad I was able to help and thanks for sharing the solution in forums - certainly will be helpful for other customer as well.

    Just wanted to follow-up that I think I know what is going on under the hood and why SelectedRowChanged did not fire. This most probably has something to do with Page Lifecycle and events (Init, Load, PreRender, etc). Event handlers that are fired on postback like SelectedRowChanged need to be hooked in the OnInit state of the page (this is what the VS.NET designer does by default), whereas I believe in your case ItemBound for Repeater could be fired later on (by default it is in PreRender, if declarative datasource is used). This side-effect affects only SelectedRowChanged since it is a postback event, while InitializeLayout does not trigger postback - hence no problems.

    The solution you are currently using seems to be the better one, if you do need to do it with code, you can force DataBinding the Repeater in the page OnInit event (by calling Repeater1.DataBind() explicitly in the OnInit event of the page) 

    Hope this helps.

    Best Regards,
    Rumen Stankov (MCSD.NET)
    The Infragistics ASP.NET Team
    • Post Points: 20
  • 07-23-2008 15:36 In reply to

    • fender
    • Not Ranked
    • Joined on 01-28-2008
    • Points 80

    Re: WebCombo Event problem in Repeater control

    Hi Rumen.

    That's makes sense, you're a star.

    Thanks again.

     Andy

    • Post Points: 5
Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems