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

RadScheduler - Retrieving values from the SqlDataSource

5 Answers 80 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 10 Feb 2011, 01:28 AM

I have a RadScheduler populated via an SqlDataSource

The SELECT statement on the data source is this.

SqlDataSource1.SelectCommand = "SELECT * FROM [Activity] WHERE act_Rep_ID = " + ScheduleUserID.ToString();

Simple stuff.

Now in the AppointmentDateBound event I am trying to set a different color to the appointment, based on a certain value that should be in the appointment thanks to the SELECT * query in the SqlDataSource.

In this example you can see my test code where I just test the 'Subject'.

protected void RadScheduler1_AppointmentDataBound(object sender, Telerik.Web.UI.SchedulerEventArgs e)
     {
         Appointment a = e.Appointment;
    
         if (a.Subject == "Phone Call")
         {
             a.BackColor = System.Drawing.Color.Yellow;
             a.BorderColor = System.Drawing.Color.Red;
             a.BorderStyle = BorderStyle.Dotted;
             a.BorderWidth = Unit.Pixel(2);
         }
     }


The value I need however is a value that is in the Activity table, but is not listed as a property of the appointment object.

In fact, the appointment object only holds a fraction of the values from each Activity table row.

How do I get to all the other values that this SqlDataSource would be holding ?

5 Answers, 1 is accepted

Sort by
0
Brad
Top achievements
Rank 1
answered on 11 Feb 2011, 07:02 AM
Wow. Over 20 people have looked at this and nobody knows the answer.

This tells me that it is not possible, or, that it so obvious I should know better.

In either case, can someone please offer some help?

0
Veronica
Telerik team
answered on 11 Feb 2011, 10:07 AM
Hi Brad,

You'll need to save the selected color in a custom attribute and apply it to the appointment in the AppointmentDataBound event similar to this Demo and the corresponding help article. Otherwise I can not imagine how you will keep the relationship between the "Activity" table and each particular appointment.

Greetings,
Veronica Milcheva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Brad
Top achievements
Rank 1
answered on 16 Feb 2011, 05:24 AM
Veronica

This is not about saving the color. It is about setting a color based on value that for some reason I can't get out of the SqlDataSource.

It is also nothing to do with the Advanced Edit Form.

I'll be more specific

First, an Activity IS an appointment in my DB.

Each appointment in my Activity table has an act_Location_ID.

I need to get this act_Location_ID value out of the SqlDataSource as each appointment is written. I know were to put the code, I know how to set the color, what I don't have is the value from each activity to test.

You can see in my code below, I doing this.

if (a.Subject == "Phone Call")
{
 
}

What I need to be able to do is this...

if (a.act_Location_ID == 0)
{
 
}

How do I get the act_Location_ID?
0
Accepted
Veronica
Telerik team
answered on 18 Feb 2011, 10:19 AM
Hello Brad,

As I understand the act_Location_ID is an additional field in the Activity table which is not related directly to the appointments (it is neither Start, End, Subject, ID, etc.). So my suggestion for you is to create a Custom Attribute and keep it's values in the act_Location_ID field. That way you can easily check the value via the Appointment object:

a.Attributes["activity_location"] == "0"
        {
            ...
        }

Regards,
Veronica Milcheva
the Telerik team
0
Brad
Top achievements
Rank 1
answered on 21 Feb 2011, 02:13 AM
DIng! That did the trick Veronica.

Thank you so much for your help.

Brad
Tags
General Discussions
Asked by
Brad
Top achievements
Rank 1
Answers by
Brad
Top achievements
Rank 1
Veronica
Telerik team
Share this question
or