Problem With Ajax Linked ComboBox

Page 1 of 2 12 LastLast
  1. #1

    Problem With Ajax Linked ComboBox


    Hi .. I m trying to use Linked ComboBox as Specified in Examples but still its not working .. I am developing the application on dotnetnuke ...

    Is there any problem with ASP.NET Ajax Registration in dotnetnuke.

    I have even tried Linked ComboBox Example using WebService even that is not working .?

    One More thing i tried is OnChange Event for the ComboBox .. but in that also Its not able to bind the Second ComboBox ..?

    Any Ideas?
  2. #2

    RE: Problem With Ajax Linked ComboBox

    I also am having a similar problem. We have something called Follow-Me on Page_Load I can set the first combo value, then call LoadDepartmentByFaculty(Me, Nothing) and then set the second value. It works. However, when I call LoadItem (ajax call from a GridPanel) I can get the first combobox to load and select the proper value, but it shows the "value" not the description and the second combobox has 0 items.
  3. #3

    RE: Problem With Ajax Linked ComboBox

    Hi,

    We need the sample for testing


    If combo display 'value' instead 'text' then it is mean that combo's store doesn't contain such value
  4. #4

    RE: Problem With Ajax Linked ComboBox

    Here are my stores/data sources:

    
    
    
    <asp:ObjectDataSource ID="dsJobClassList" runat="server" SelectMethod="GetJobClassList"
    
    
    TypeName="UOttawa.BusinessObjects.ConfigListCollection" 
    
    
    OldValuesParameterFormatString="original_{0}" >
    
    
    </asp:ObjectDataSource>
    
    
    
    
    
    <ext:Store ID="stoJobClassList" runat="server" DataSourceID="dsJobClassList">
    
    
    <Reader>
    
    
    <ext:JsonReader ReaderID="CodeName">
    
    
    <Fields>
    
    
    <ext:RecordField Name="CodeName" />
    
    
    <ext:RecordField Name="CodeValue" />
    
    
    </Fields>
    
    
    </ext:JsonReader>
    
    
    </Reader>
    
    
    </ext:Store>
    
    
    <asp:ObjectDataSource ID="dsEditRateType" runat="server" SelectMethod="GetRateTypeListByJobClass"
    
    
    TypeName="UOttawa.BusinessObjects.ConfigListCollection" 
    
    
    OldValuesParameterFormatString="original_{0}" >
    
    
    <SelectParameters>
    
    
    <asp:Parameter DefaultValue="" Name="JobClassCode" Type="String" />
    
    
    </SelectParameters>
    
    
    </asp:ObjectDataSource>
    
    
    
    
    
    <ext:Store ID="stoEditRateType" runat="server" DataSourceID="dsEditRateType" OnRefreshData="LoadEditRateType">
    
    
    <Reader>
    
    
    <ext:JsonReader ReaderID="CodeName">
    
    
    <Fields>
    
    
    <ext:RecordField Name="CodeName" />
    
    
    <ext:RecordField Name="CodeValue" />
    
    
    </Fields>
    
    
    </ext:JsonReader>
    
    
    </Reader>
    
    
    <Listeners>
    
    
    <Load Handler="if(this.getAt(0)!=null)#{cbRateType}.setValue(this.getAt(0).data[#{cbJobClass}.valueField]);" />
    
    
    </Listeners> 
    
    
    </ext:Store>
    Here is the XML source markup:

    
    
    
    
    <ext:Anchor>
    
    
    <ext:ComboBox 
    
    
    ID="cbJobClass"
    
    
    runat="server" 
    
    
    StoreID="stoJobClassList"
    
    
    FieldLabel="Job Class"
    
    
    Width="220"
    
    
    Editable="true"
    
    
    DisplayField="CodeValue"
    
    
    ValueField="CodeName"
    
    
    TypeAhead="true" 
    
    
    Mode="Local"
    
    
    ForceSelection="true"
    
    
    TriggerAction="All"
    
    
    EmptyText="Select..."
    
    
    SelectOnFocus="true">
    
    
    <Listeners>
    
    
    <Select Handler="#{cbRateType}.clearValue();#{stoEditRateType}.reload();" />
    
    
    </Listeners>
    
    
    </ext:ComboBox> 
    
    
    </ext:Anchor> 
    
    
    <ext:Anchor>
    
    
    <ext:ComboBox 
    
    
    ID="cbRateType"
    
    
    runat="server" 
    
    
    StoreID="stoEditRateType"
    
    
    FieldLabel="Rate Type"
    
    
    Width="220"
    
    
    Editable="true"
    
    
    DisplayField="CodeValue"
    
    
    ValueField="CodeName"
    
    
    TypeAhead="true" 
    
    
    Mode="Local"
    
    
    ForceSelection="true"
    
    
    TriggerAction="All"
    
    
    EmptyText="Select..."
    
    
    SelectOnFocus="true">
    
    
    </ext:ComboBox>
    
    
    </ext:Anchor>
    and the code-behind:

    
    
    
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
    
    If (Ext.IsAjaxRequest = False) Then
    
    
    btnDeleteRow.Enabled = False
    
    
    End If
    
    
    End Sub
    
    
    Protected Sub RowSelect(ByVal sender As Object, ByVal e As AjaxEventArgs)
    
    
    Me.lblStatus.Html = ""
    
    
    Dim _strRowID As String = e.ExtraParams("RowID")
    
    
    LoadItem(e.ExtraParams("JobClassRatesID"))
    
    
    End Sub
    
    
    Protected Sub LoadItem(ByVal JobClassRatesID As Long)
    
    
    Dim _col As JobClassRateCollection = New JobClassRateCollection()
    
    
    Dim item As JobClassRate = _col.FindByID(JobClassRatesID)
    
    
    Me.txtJobClassRatesID.Text = item.JobClassRatesID
    
    
    'Me.cbJobClass.SetValue(item.JobClassCode) 
    
    
    Me.cbJobClass.SelectedItem.Value = item.JobClassCode
    
    
    LoadEditRateType(Me, Nothing)
    
    
    'Me.cbRateType.SetValue(item.RateCode) 
    
    
    Me.cbRateType.SelectedItem.Value = item.RateCode
    
    
    Me.cbRateType.SetValue(item.RateCode)
    
    
    Me.txtStartDate.SelectedDate = item.StartDate
    
    
    Me.txtEndDate.SelectedDate = item.EndDate
    
    
    Me.txtRegularRate.Text = Common.FormatCurrency(Convert.ToDouble(item.RegularRate))
    
    
    Me.txtVacationRate.Text = Common.FormatCurrency(Convert.ToDouble(item.VacationRate))
    
    
    Me.lblUpdateUserID.Text = item.UpdateUserID
    
    
    Me.lblUpdateTimestamp.Text = Common.GetMidDate(item.UpdateTimestamp) + " " + Common.GetTime(item.UpdateTimestamp)
    
    
    End Sub
    
    
    Protected Sub LoadEditRateType(ByVal sender As Object, ByVal e As StoreRefreshDataEventArgs)
    
    
    dsEditRateType.SelectParameters("JobClassCode").DefaultValue = Me.cbJobClass.SelectedItem.Value
    
    
    dsEditRateType.DataBind()
    
    
    End Sub
  5. #5

    RE: Problem With Ajax Linked ComboBox

    Hi,

    Sorry but it is hard to say whats wrong using only piece of code. I can't test your code. Just create simple example with test data (you can bind store by temporary using generic list instead ObjectDataSource). We need example which we can test without modification from our side. Thanks
  6. #6

    RE: Problem With Ajax Linked ComboBox

    I've attached a screenshot so you can see... the AJAX part of the combo (when I select Job Class on the form) it works, but I can't get it to work when I run a RowSelect, is there a way to get that second ComboBox to load based on the first Job Class Code?
  7. #7

    RE: Problem With Ajax Linked ComboBox

    Hi,

    Try to call in LoadItem


    cbJobClass.FireEvent("select", null);


    after setting selected item
  8. #8

    RE: Problem With Ajax Linked ComboBox

    bingo!! :)

    now i am trying to figure out how to set the correct valueField... how do i get the current value (selecteditem) via javascript to set it?
  9. #9

    RE: Problem With Ajax Linked ComboBox

    Hi,

    Current value: combo.getValue()
    But you don't need to set it because it is setted already. I think the problem that combo's store doesn't contain the record with such value
  10. #10

    RE: Problem With Ajax Linked ComboBox

    I think it would be cool if there was a Listener called 'Custom' that way I could call it specifically using cbJobClass.FireEvent("custom", null); the reason being... Select listener is called when I click on the JobClass also, I was using #{cbRateType}.clearValue();#{stoEditRateType}.relo ad(); but sometimes I'd like to call clearValue() and other times not, depending on the screen.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: Mar 31, 2012, 9:10 AM
  2. [CLOSED] EditableGrid -- ajax linked combobox
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Mar 15, 2011, 7:53 AM
  3. Ajax linked combos
    By ddolan in forum 1.x Help
    Replies: 0
    Last Post: Feb 17, 2011, 8:30 PM
  4. Replies: 2
    Last Post: Nov 26, 2010, 2:31 PM
  5. ajax linked combobox
    By studentdev in forum 1.x Help
    Replies: 1
    Last Post: Feb 05, 2010, 5:03 AM

Posting Permissions