This is a migrated thread and some comments may be shown as answers.

How can I display Data of my RadComboxes in RadScheuler as Subject and Description?

8 Answers 103 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Shirani
Top achievements
Rank 1
Shirani asked on 02 Dec 2011, 09:45 AM
Hello
I am Using RelatedLoDRadComboboxesInAdvForm and I want to Display some of my text in my Appointment when all data is saved.
 but Its Showing like this in my 1.jpg

AdvancedForm.aspx
  
<asp:Panel  runat="server" ID="ResourceControls">
 <asp:Label ID="Label1" runat="server" AssociatedControlID="ContinentsRadComboBox">Continent:</asp:Label>
                        <telerik:RadComboBox ID="ContinentsRadComboBox" runat="server" Width="186px"
                            OnClientSelectedIndexChanged="LoadCountries" />
                         
                        <asp:Label ID="Label2" runat="server" AssociatedControlID="CountriesRadComboBox">Country:</asp:Label>
                        <telerik:RadComboBox ID="CountriesRadComboBox" runat="server" Width="186px" 
                            OnClientItemsRequested="CountriesLoaded"  OnClientSelectedIndexChanged="LoadCities" 
                            EnableViewState="false" />
  
  
                            <asp:Label ID="Label3" runat="server" AssociatedControlID="CitiesRadComboBox">Cities:</asp:Label>
                        <telerik:RadComboBox ID="CitiesRadComboBox" runat="server" Width="186px"
                             
                            OnClientItemsRequested="CitiesLoaded"
                            EnableViewState="false" />
    </asp:Panel>
  
DefaultVB.apsx
  
 <AppointmentTemplate>
            <div class="rsAptSubject">
            <%# Eval("Subject")%>
            </div>
            <div>  <%# Eval("Description")%></div>
            <div>  <%# Eval("Continent")%></div>
             <div>  <%# Eval("Country")%></div>
              <div>  <%# Eval("City")%></div>
              
            </AppointmentTemplate>
 But its Showing me my IDs instead of Names...
Please Help

8 Answers, 1 is accepted

Sort by
0
Shirani
Top achievements
Rank 1
answered on 02 Dec 2011, 05:50 PM
Still No Reply and Response....:(
0
Ivana
Telerik team
answered on 07 Dec 2011, 09:19 AM
Hi Shirani,

The reason why the selected value is shown in the appointment's template instead of the selected item's text, is that the corresponding Getter property, in the code-behind of the AdvancedForm file, is implemented this way. If you take a look at that implementation, you will see that the Continent or Country property,  returns the selected value of the corresponding RadComboBox, instead of its selected item' text.

Attached is a file showing how the scenario in question could be achieved.

I hope this helps.

Kind regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Shirani
Top achievements
Rank 1
answered on 08 Dec 2011, 12:22 PM
Thanks Ivana

Can you help me again for this.I am using Q3 Sp1 2009 Controls.And with VB.Net and Downloaded this

RelatedLoDRadComboboxesInAdvForm

Can you change it for me....? or otherwise please take a look and tell me wehre i should change my code
I am using this as

1. AdvancedForm.aspx 
<script type="text/javascript">
    function CountriesLoaded(combo, eventArqs) {
        if (combo.get_items().get_count() > 0) {
            // Pre-select the first country
            combo.set_text(combo.get_items().getItem(0).get_text());
            combo.get_items().getItem(0).highlight();
        }
        combo.showDropDown();
    }
  
    function LoadCountries(combo, eventArqs) {
        var item = eventArqs.get_item();
        var countriesCombo = $find("<%= CountriesRadComboBox.ClientID %>");
        countriesCombo.set_text("Loading...");
  
        // Is continent selected?
        if (item.get_index() > 0) {
            // Request items through the ItemsRequested event of the 
            // countries RadComboBox passing the continentID as a parameter 
            countriesCombo.requestItems(item.get_value(), false);
        }
        else {
            // The "-Select a continent-" item was chosen
            countriesCombo.set_text(" ");
            countriesCombo.clearItems();
        }
    }
  
  
  
    function CitiesLoaded(combo, eventArqs) {
        if (combo.get_items().get_count() > 0) {
            // Pre-select the first City
            combo.set_text(combo.get_items().getItem(0).get_text());
            combo.get_items().getItem(0).highlight();
        }
        combo.showDropDown();
    }
  
    function LoadCities(combo, eventArqs) {
        var item = eventArqs.get_item();
        var citiesCombo = $find("<%= CitiesRadComboBox.ClientID %>");
        citiesCombo.set_text("Loading...");
  
        // Is continent selected?
        if (item.get_index() > 0) {
            // Request items through the ItemsRequested event of the 
            // countries RadComboBox passing the continentID as a parameter 
            citiesCombo.requestItems(item.get_value(), false);
        }
        else {
            // The "-Select a continent-" item was chosen
            citiesCombo.set_text(" ");
            citiesCombo.clearItems();
        }
    }
</script>

<

 

 

asp:Panel runat="server" ID="ResourceControls">

 

 

 

<asp:Label ID="Label1" runat="server" AssociatedControlID="ContinentsRadComboBox">Continent:</asp:Label>

 

 

 

<telerik:RadComboBox ID="ContinentsRadComboBox" runat="server" Width="186px"

 

 

 

OnClientSelectedIndexChanged="LoadCountries" />

 

 

 

 

<asp:Label ID="Label2" runat="server" AssociatedControlID="CountriesRadComboBox">Country:</asp:Label>

 

 

 

<telerik:RadComboBox ID="CountriesRadComboBox" runat="server" Width="186px"

 

 

 

OnClientItemsRequested="CountriesLoaded" OnClientSelectedIndexChanged="LoadCities"

 

 

 

EnableViewState="false" />

 

 

 

 

<asp:Label ID="Label3" runat="server" AssociatedControlID="CitiesRadComboBox">Cities:</asp:Label>

 

 

 

<telerik:RadComboBox ID="CitiesRadComboBox" runat="server" Width="186px"

 

 

 

 

OnClientItemsRequested="CitiesLoaded"

 

 

 

EnableViewState="false" />

 

 

 

</asp:Panel>

 


2.AdvancedForm.aspx.vb
'Continent, Coutry
        <Bindable(BindableSupport.Yes, BindingDirection.TwoWay)> _
        Public Property Continent() As String
            Get
                Return ContinentsRadComboBox.SelectedValue
            End Get
  
            Set(ByVal value As String)
                ContinentsRadComboBox.SelectedValue = value
            End Set
        End Property
  
        <Bindable(BindableSupport.Yes, BindingDirection.TwoWay)> _
        Public Property Country() As String
            Get
                Return CountriesRadComboBox.SelectedValue
            End Get
  
            Set(ByVal value As String)
                ' Store the selected country ID until we obtain the continent ID
                _selectedCountry = value
            End Set
        End Property
  
        <Bindable(BindableSupport.Yes, BindingDirection.TwoWay)> _
        Public Property City() As String
            Get
                Return CitiesRadComboBox.SelectedValue
            End Get
  
            Set(ByVal value As String)
                ' Store the selected city ID until we obtain the country ID
                _selectedCities = value
            End Set
        End Property

3.Defaultvb.aspx

<AppointmentTemplate>
            <div class="rsAptSubject">
            <%# Eval("Subject")%>
            </div>
            <div>  <%# Eval("Description")%></div>
            <div>  <%# Eval("Continent")%></div>
             <div>  <%# Eval("Country")%></div>
              <div>  <%# Eval("City")%></div>
              
            </AppointmentTemplate>
        <AdvancedEditTemplate>
            <scheduler:AdvancedForm runat="server" ID="AdvancedEditForm1" Mode="Edit" Subject='<%# Bind("Subject") %>'
                Start='<%# Bind("Start") %>' End='<%# Bind("End") %>'    Description='<%# Bind("Description") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'
                Continent='<%# Bind("Continent") %>'
                Country='<%# Bind("Country") %>'
                Annotation='<%# Bind("Annotations") %>'
                 MyName='<%# Bind("MyName") %>'
                 City='<%# Bind("City") %>'/>
        </AdvancedEditTemplate>
        <AdvancedInsertTemplate>
            <scheduler:AdvancedForm runat="server" ID="AdvancedInsertForm1" Mode="Insert" Subject='<%# Bind("Subject") %>'
                Start='<%# Bind("Start") %>' End='<%# Bind("End") %> ' Description='<%# Bind("Description") %>' RecurrenceRuleText='<%# Bind("RecurrenceRule") %>'
                Continent='<%# Bind("Continent") %>'
                Country='<%# Bind("Country") %>'
                Annotation='<%# Bind("Annotations") %>'
                MyName='<%# Bind("MyName") %>' 
                City='<%# Bind("City") %>'/>
        </AdvancedInsertTemplate>       
    </telerik:RadScheduler>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>" 
        DeleteCommand="DELETE FROM [Appointments] WHERE [ID] = @ID" 
        InsertCommand="INSERT INTO [Appointments] ([Subject], [Start], [End], [UserID], [RoomID], [RecurrenceRule], [RecurrenceParentID], [Description], [Continent], [Country], [Annotations],[MyName],[City]) VALUES (@Subject, @Start, @End, @UserID, @RoomID, @RecurrenceRule, @RecurrenceParentID, @Description, @Continent, @Country, @Annotations,@MyName,@City)" 
        SelectCommand="SELECT * FROM [Appointments]" 
        UpdateCommand="UPDATE [Appointments] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [UserID] = @UserID, [RoomID] = @RoomID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID, [Description] = @Description, [Continent] = @Continent, [Country] = @Country,[Annotations]= @Annotations,[MyName]= @MyName,[City]=@City WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Subject" Type="String" />
            <asp:Parameter Name="Start" Type="DateTime" />
            <asp:Parameter Name="End" Type="DateTime" />
            <asp:Parameter Name="UserID" Type="Int32" />
            <asp:Parameter Name="RoomID" Type="Int32" />
            <asp:Parameter Name="RecurrenceRule" Type="String" />
            <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Annotations" Type="String" />
            <asp:Parameter Name="Continent" Type="String" />
            <asp:Parameter Name="Country" Type="String" />
             <asp:Parameter Name="MyName" Type="String" />
             <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Subject" Type="String" />
            <asp:Parameter Name="Start" Type="DateTime" />
            <asp:Parameter Name="End" Type="DateTime" />
            <asp:Parameter Name="UserID" Type="Int32" />
            <asp:Parameter Name="RoomID" Type="Int32" />
            <asp:Parameter Name="RecurrenceRule" Type="String" />
            <asp:Parameter Name="RecurrenceParentID" Type="Int32" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="Annotations" Type="String" />
            <asp:Parameter Name="Continent" Type="String" />
            <asp:Parameter Name="Country" Type="String" />
            <asp:Parameter Name="MyName" Type="String" />
             <asp:Parameter Name="City" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>

0
Accepted
Ivana
Telerik team
answered on 08 Dec 2011, 05:59 PM
Hello Shirani,

You could use the online C# to VB convertor, to convert the code. Everything in the project I have sent you in my previous post, is the same as in the following KB: RadScheduler / Related RadComboBoxes in the AdvancedForm, except the following code in the code-behind file of the AdvancedForm's user control:
private string _selectedCountry;
private string _country;
private string _continent;
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public string Continent
{
    get
    {
        return ContinentsRadComboBox.Text;
    }
 
    set
    {
        if (ContinentsRadComboBox.FindItemByText(value) != null)
        {
            (ContinentsRadComboBox.FindItemByText(value) as RadComboBoxItem).Selected = true;
        }
        _continent = ContinentsRadComboBox.SelectedValue;
    }
}
 
[Bindable(BindableSupport.Yes, BindingDirection.TwoWay)]
public string Country
{
    get
    {
        return CountriesRadComboBox.Text;
    }
 
    set
    {
        _selectedCountry = value;
    }
}

You could refer to the project, for more details.

Regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Shirani
Top achievements
Rank 1
answered on 09 Dec 2011, 05:47 AM
Thank you so much  Ivana....
Now I can View all my Combos Selected and Saved Text on my Scheduler.
With help of this Code.

But now there  is another Problem...
When I try to Edit my Shcduler Information.
It just shows Continents List , Country and City Combos are empty...
In my Previous Code it saves my 3 Combos Data.

Please help on this too..
Thanks

0
Peter
Telerik team
answered on 12 Dec 2011, 04:02 PM
Hi Shirani,

In our local sample we don't experience this problem so we are not sure what could be causing this at your side.

Regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Shirani
Top achievements
Rank 1
answered on 12 Dec 2011, 04:06 PM
Thanks Peter
I dont know why there is problem in my Sheduler. When I edit it does not Show this but saves successfully data into db.
Anyways its saving into db and showing on sheduler my Combo's Text.(Only not retrieving data into Combos in Edit mode of sheduler).


Regards
0
Ivana
Telerik team
answered on 13 Dec 2011, 03:38 PM
Hello Shirani,

In the sample project I have sent you in some of my previous massages, there is no RadComboBox which contains the Cities for the currently selected Country. But, you could easily implement this scenario using the following online demo: Related RadComboBoxes and following the implementation of the Continent and City related RadComboBoxes in the AdvancedForm of the RadScheduler.

I hope this is helpful.

Best wishes,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Scheduler
Asked by
Shirani
Top achievements
Rank 1
Answers by
Shirani
Top achievements
Rank 1
Ivana
Telerik team
Peter
Telerik team
Share this question
or