Telerik Forums RSShttp://www.telerik.com/urn:uuid:0e62dea4-c9e6-46cd-bb2e-d3c9f1b08c92http://www.telerik.com/forums/permalink/pN5iDubJzUa7LtPJ8bCMkgHow to get selected time period<p>Hello <g class="gr_ gr_17 gr-alert gr_spell gr_disable_anim_appear undefined ContextualSpelling ins-del multiReplace" id="17" data-gr-id="17">Chandz</g>,</p>
<p>Thank you for writing.</p>
<p>I would like to note that this forum is related to the Telerik UI for WinForms suite. However, your question seems to be connected with the ASP.NET product. Feel free to post your question in the relevant forum: <a href="http://www.telerik.com/forums">http://www.telerik.com/forums</a></p>
<p>I hope this information helps. Should you have further questions I would be glad to help.</p>
Regards,<br />
Dess <br />
Telerik
<div class="forumBaloon">Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the <a target="_blank" href="http://www.telerik.com/support/feedback"> Telerik Feedback Portal</a> and vote to affect the priority of the items</div>urn:uuid:ba09040f-638a-4eb3-933c-12370a5ec7e5http://www.telerik.com/forums/permalink/DwQJuopjs06TPBI3Cl7H5QHow to get selected time periodHello Telerik team,<br />
<br />
&nbsp;I have a Radscheduler and an individual button, in a web form in my aspx page(c# and Asp.net).<br />
<br />
when in week view of the scheduler, it displays the first week (i.e) &nbsp;jan 3 2016 sunday to jan 9 2016 saturday,<br />
<br />
i want to view the next week on button click (i.e) &nbsp;jan 10 2016 sunday to jan 16 2016 saturday,<br />
<br />
telerik has dayview, weekview, monthview, agendaview and timelineview but not nextweekview..<br />
<br />
Googling does not help me in this case.<br />
<br />
&nbsp;<br />
<br />
Thanks in advance..<br />
<br />
Hope you people reply a bit faster.urn:uuid:6f6a6007-8cd5-4174-a4c2-a3da915b7ac4http://www.telerik.com/forums/permalink/B2Bqb9WMdEGkwqPakVt6xAHow to get selected time periodHello Gerhard,<br />
<br />
The approach should be the same in C# and VB. However, you can try using one of the following methods of the <strong>SchedulerUIHelper </strong>class:<br />
<div style="border: 1px solid #7f9db9; overflow-y: auto;" class="tFormatCodeBlock supportThreadCodeBlock" id="highlighter_15771">
<div style="background-color: #ffffff;"><span style="margin-left: 0px !important;"><code style="color: #000000;">SchedulerUIHelper.GetCells(</code><code style="color: #006699; font-weight: bold;">Me</code><code style="color: #000000;">.RadScheduler1)</code></span></div>
<div style="background-color: #f8f8f8;"><span style="margin-left: 0px !important;"><code style="color: #000000;">SchedulerUIHelper.GetSelectedCells(</code><code style="color: #006699; font-weight: bold;">Me</code><code style="color: #000000;">.RadScheduler1)</code></span></div>
<div style="background-color: #ffffff;"><span style="margin-left: 0px !important;"><code style="color: #000000;">SchedulerUIHelper.GetSelectedDates(</code><code style="color: #006699; font-weight: bold;">Me</code><code style="color: #000000;">.RadScheduler1)</code></span></div>
</div>
<br />
If you have any additional questions, please let me know.<br />
<br />
Greetings,<br />
Ivan Todorov <br />
the Telerik team
<div class="forumBaloonTop"></div>
<div class="forumBaloon">Q3&rsquo;12 of RadControls for WinForms is available for <a href="http://www.telerik.com/account/your-products/trial-product-versions/download-trial-file.aspx?pid=523">download</a> (see <a href="http://www.telerik.com/products/winforms/whats-new.aspx">what's new</a>). <a href="http://www.telerik.com/account/your-products/trial-product-versions/download-trial-file.aspx?pid=523">Get it today</a>.</div>
<div class="forumBaloonBottom"></div>urn:uuid:cfb8507b-b4ed-4a69-b6c7-67b6906de836http://www.telerik.com/forums/permalink/e1C4z-20aUq2x2e2kG3oNgHow to get selected time periodHow do I do this in VB.net. It loops through the 72 cells but everyone seems is selected = false.urn:uuid:bddfdc1e-1e9f-4cbf-987a-c73cf5e55d06http://www.telerik.com/forums/permalink/HtzfvZ8ev0yYesc89eVdBgHow to get selected time periodHi&nbsp;<br>
How would this be applied in VB.Net as the line&nbsp;<br>
<div class="tFormatCodeBlock supportThreadCodeBlock" style="border: 1px solid #7f9db9; overflow-y: auto;" id="highlighter_58682">
<div style="background-color: #ffffff;"><span style="margin-left: 0px !important;"><code style="color: #000000;">dayview = TryCast(</code><code style="color: #006699; font-weight: bold;">Me</code><code style="color: #000000;">.radSchedulerDemo.SchedulerElement.ViewElement, SchedulerDayViewElement)</code></span></div>
</div>
<br>
does not return anything for a selection event<br>urn:uuid:7f9523ff-fef2-470f-8464-97168ca73963http://www.telerik.com/forums/permalink/_yOVf_L-D0eEZJcWjKc5YwHow to get selected time periodHi Denis,<br />
<br />
This is the correct way to get the <strong>SchedulerDayViewElement</strong>, however you can get it only if <strong>RadScheduler </strong>is currently under <strong>DayView</strong>. Otherwise the <strong>ViewElement </strong>will be of different type and the <strong>TryCast </strong>will return <em>Nothing</em>.<br />
<br />
If your goal is to get the selected dates, then you can use the following method to achieve this without having to cast any elements:<br />
<div style="border: 1px solid #7f9db9; overflow-y: auto;" class="tFormatCodeBlock supportThreadCodeBlock" id="highlighter_32975">
<div style="background-color: #ffffff;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Dim </code><code style="color: #000000;">dates </code><code style="color: #006699; font-weight: bold;">As </code><code style="color: #000000;">DateTime() = SchedulerUIHelper.GetSelectedDates(</code><code style="color: #006699; font-weight: bold;">Me</code><code style="color: #000000;">.RadScheduler1)</code></span></div>
<div style="background-color: #f8f8f8;"><span style="margin-left: 0px !important;"><code style="color: #000000;">Array.Sort(dates)</code></span></div>
<div style="background-color: #ffffff;"><span style="margin-left: 0px !important;"><code style="color: #006699; font-weight: bold;">Dim </code><code style="color: #000000;">interval </code><code style="color: #006699; font-weight: bold;">As </code><code style="color: #006699; font-weight: bold;">New </code><code style="color: #000000;">DateTimeInterval(dates(0), dates(dates.Length - 1))</code></span></div>
</div>
<br />
If your requirement is different, then please share more details on it and I will assist you in achieving it.<br />
<br />
Should you have any other questions, feel free to ask.<br />
<br />
Kind regards,<br />
Ivan Todorov <br />
the Telerik team
<div style="font-size: 10px; padding-top: 10px;">
<br />
Instantly find answers to your questions on the new <a style="color: gray;" href="http://www.telerik.com/support"> Telerik Support Portal</a>.
<br />
Watch a <a style="color: gray;" href="http://tv.telerik.com/telerik/support/using-telerik-support-resources">video</a> on how to optimize your support resource searches and <a style="color: gray;" href="http://blogs.telerik.com/supportdept/posts/08-12-22/New_support_resources_search_facilities_on_telerik_com.aspx">check out more tips</a> on the blogs.
</div>urn:uuid:f6e58ba7-4dc5-4fc5-a454-48eb0972a596http://www.telerik.com/forums/permalink/p4vl9sVNxU-kVEjrCXKllgHow to get selected time periodI had the same request and thank to that <span style="color: rgb(0, 0, 0); font-family: monospace; font-size: 16px; line-height: normal; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">explanation i resolved! Thanks <span style="font-family: arial, sans-serif; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(51, 51, 51); font-size: 14px; line-height: 19px; ">Boyko Markov for the perfect solution</span></span>urn:uuid:ea9a0da0-e05a-4e2a-b518-d6158bff9856http://www.telerik.com/forums/permalink/oA2a6lrgKk61GNYVi_-YVgHow to get selected time periodThanks! That almost got it, I just had to add time to the end of the max date (thirty minutes in my case) to find the time period from the beginning of the first cell to the end of the last cell.<div><br /></div><div>Thanks for the help.</div>urn:uuid:29794c6a-542b-4df4-a98e-c86a89398f95http://www.telerik.com/forums/permalink/akx5KStU9E2pjshqiTmPlQHow to get selected time periodHello Marcus,<br />
<br />
Thank you for contacting us. I have prepared a simple solution how to get the selection start and selection end dates.<br />
<br />
1. Get the dayview element instance from RadScheduler.<br />
<br />
&nbsp; SchedulerDayViewElement dayview = (this.radSchedulerDemo.SchedulerElement.ViewElement as SchedulerDayViewElement);<br />
2. Get the selection MinDate and selection MaxDate. I'm doing this by iterating over the cells collection. Then check whether a cell is selected and initialize the minDate and maxDate fields:<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DateTime minDate = DateTime.MaxValue;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DateTime maxDate = DateTime.MinValue;<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach (RadElement element in dayview.DataAreaElement.Table.Children)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SchedulerCellElement cell = element as SchedulerCellElement;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (cell != null &amp;&amp; cell.Selected)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (minDate &gt;= cell.Date)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; minDate = cell.Date;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (maxDate &lt;= cell.Date)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxDate = cell.Date;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TimeSpan selectionDuration = maxDate - minDate;<br />
<br />
I hope this helps. Do not hesitate to write me back if you have further questions. <br />
<br />
Kind regards,<br />
Boyko Markov <br />
the Telerik team
<div style="font-size: 10px; padding-top: 10px;">
<br />
Instantly find answers to your questions on the new
<a style="color: gray;" href="http://www.telerik.com/support">
Telerik Support Portal</a>.
<br />
<a style="color: gray;" href="http://blogs.telerik.com/supportdept/posts/08-12-22/New_support_resources_search_facilities_on_telerik_com.aspx">Check out the tips</a>
for optimizing your support resource searches.
</div>
urn:uuid:758e8917-eaab-4a0a-9c60-756c13e6044fhttp://www.telerik.com/forums/permalink/F4mOdavqCkqcYHVsE-YETwHow to get selected time periodHi,<div>I have a RadScheduler that I've set up to drag and drop different tasks from a list box. Currently the task only fills one time slot (which is set at half-hour intervals) however I would like the user to be able to select a time period and drag the task to the selected area and have the "appointment" fill the entire selected area. </div><div><br /></div><div>I am having trouble retrieving the selected time period from the WinForms scheduler, is there a way to get the selected TimeSlot?</div><div><br /></div><div>Thanks is advance,</div><div>Marcus</div>