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

Filter resource on web service bound scheduler based on client input

1 Answer 11 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Prava kafle
Top achievements
Rank 1
Prava kafle asked on 30 Aug 2013, 12:58 AM
Hi,

I  need to filter resources used by Radscheduler based on client interaction,  how can I do that?
   cmd.CommandText = "SELECT * FROM [Users] where id > 0 "; /*** would like to send this sql statement from client  based on combobox selection  88?




 <telerik:RadScheduler runat="server"  ID="RadScheduler1"    OnResourcesPopulating="RadScheduler1_ResourcesPopulating"  SelectedView="WeekView" 
                  OnClientAppointmentsPopulating="OnClientAppointmentsPopulating"  Width="900px" Height="900px"    OverflowBehavior="Scroll"   OnClientResourcesPopulating="OnClientResourcesPopulating" 
               AppointmentStyleMode="Default" 
               >
                            <DayView UserSelectable="True" GroupBy="TechName" GroupingDirection="Horizontal" />
                            <WeekView UserSelectable="True" GroupBy="TechName" GroupingDirection="Vertical"  />
                            <MonthView UserSelectable="True" GroupBy="TechName" GroupingDirection="Vertical"  />
                             <TimelineView  GroupBy="TechName" ColumnHeaderDateFormat="h:mm tt" GroupingDirection="Vertical" HeaderDateFormat="MM/dd/yyyy h:mm tt"
                                NumberOfSlots="21"  SlotDuration="00:30:00" StartTime="08:00:00" />
                            
    <WebServiceSettings   Path="M4SchWebService.asmx" ResourcePopulationMode="ServerSide" />
                 <ResourceTypes>
                    <telerik:ResourceType Name="TechName" />
                    <telerik:ResourceType Name="TicketState" />

                </ResourceTypes>
</telerik:RadScheduler>


private IEnumerable<Resource> LoadTechNames()
        {
            List<Resource> resources = new List<Resource>(); 
            try
            {
                using (DbConnection conn = OpenConnection())
                {
                    DbCommand cmd = DbFactory.CreateCommand();
                    cmd.Connection = conn;
                    cmd.CommandText = "SELECT * FROM [Users] where id > 0 "; /*** would like to send this sql statement from client  based on combobox selection  ****/

                    DataTable dt = new DataTable();
                    SqlDataAdapter da = new SqlDataAdapter(cmd.CommandText, cmd.Connection as SqlConnection);
                    da.Fill(dt);
                    da.Dispose();

                    if (dt.Rows.Count < 1)
                        return resources;

                    foreach (DataRow row in dt.Rows)
                    {
                        Resource res = new Resource();
                        res.Type = "TechName";
                        res.Key = row["ID"];
                        res.Text = Convert.ToString(row["TechName"]);
                        //res.Attributes["Phone"] = Convert.ToString(row["Phone"]);

                        resources.Add(res);
                    }
                }//end of using
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return resources;
        }



Thanks,
Prava

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 03 Sep 2013, 08:27 AM
Hello,

Thank you for contacting Telerik Support.

I would suggest reviewing the following help article showing how you can send additional information to the web service. That way you can filter or use it in your code implementation.

Hope that this will be helpful.

Regards,
Boyan Dimitrov
Telerik
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 the blog feed now.
Tags
Scheduler
Asked by
Prava kafle
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or