Infragistics Home

Infragistics Forums

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

Initial value for a Webcombo

Last post 09-01-2008 20:37 by davidtravis2. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-31-2008 21:40

    Initial value for a Webcombo

    Hi,

     

    I am having problems when setting a webcombo to an initial value. The code below usually fails when the selected index has a large value (there are 25,000 sites). When the DuplicateID is a low value (10 to 20) it usually works.  However there is no consistency. It seems to me that the databind is not always retrieving a dataset that contains the Duplicate although,  when I check the the data retrieved by the SQL in the method AHMSSite.GetSiteListNoDuplicates, it always has the DuplicateID that the FindByValue is looking for. 

    What Can I do? Isn’t there a better way to handle this whole process? All I want to do is place an initial value in the webcombo, I would have thought that Me.cmbDuplicateSite.Datavalue = DuplicateID was all that was required, instead there is a massive retrieval and search required and it doesn’t always work.

     

    I have read the other posts on this topic but the solution I have below came from Infragistics Support. They will no doubt get to me in time but meanwhile I have a bunch of disgruntled users.

    Thanks for your help.  If Not Page.IsPostBack Then
     
    If .DuplicateID <> 0 Then
       
    With Me.cmbDuplicateSite
        
    .DataTextField = "STR_SITE_ID"
        
    .DataValueField = "SITE_ID"
        
    .DataSource = AHMSSite.GetSiteListNoDuplicates(Page.ItemID,“SITE_ID")
        
    .DataBind()
        
    .SelectedIndex = .FindByValue(AHMSSite.DuplicateID).Row.Index
      
    End With
     
    End If
    E
    nd if   

    Private Sub cmbDuplicateSite_InitializeDataSource(ByVal sender As Object, ByVal e As Infragistics.WebUI.WebCombo.WebComboEventArgs) Handles cmbDuplicateSite.InitializeDataSource
     
    cmbDuplicateSite.DataTextField = "STR_SITE_ID"
     
    cmbDuplicateSite.DataValueField = "SITE_ID"
     
    e.Combo.DataSource = AHMSSite.GetSiteListNoDuplicates(Page.ItemID, "SITE_ID")
    E
    nd Sub

     

    • Post Points: 5
  • 09-01-2008 20:37 In reply to

    Re: Initial value for a Webcombo

    I thought about the problem a bit more and, even though I believe the behaviour to be a bug in webcombo (hey, it can't find a value that is definitely in the result set of the databind), I figured I would make it easy for the webcombo and only retrieve the actual record I needed.

    This works (so far anyway). If the user uses the webcombo after the initial display then the InitializeDataSource will be raised and the result set selected this time is the entire set of values.

     I guess another workaround would be to change the initial set retrieved (default 15 I think) to a large number (40,000 in this case to allow for growth) but this would mean a big performance hit.

    Anyone else having similar problems?

    Dave

     

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