Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
121 views
Hi,

Let me first start by saying I like your controls and products. I am implementing a RadGrid and Scheduler with the idea of dragging and dropping rows from the grid and placing them on the scheduler. I am using the following demo as a guideline: 
http://demos.telerik.com/aspnet-ajax/scheduler/examples/draganddropintegration/defaultcs.aspx?product=scheduler

The issue I am having is that in your example you are filling the rad grid with task data whose data table has an ID column with an int data type. When you drop the row over the grid it appears to use that integer ID field as the appointment id and places a new appointment in the index.

Like this: 
protected void RadGrid1_RowDrop(object sender, GridDragDropEventArgs e)
        {
            GridDataItem dataItem = e.DraggedItems[0];
 
            Hashtable values = new Hashtable();
            dataItem.ExtractValues(values);
            (int)dataItem.GetDataKeyValue("ID");
            string firstName = (string)values["FirstName"];
            string lastName = (string)values["LastName"];
            string targetSlotIndex = TargetSlotHiddenField.Value;
 
            if (targetSlotIndex != string.Empty)
            {
                HandleSchedulerDrop(id, firstName, targetSlotIndex);
                TargetSlotHiddenField.Value = string.Empty;
            }
            RadScheduler1.Rebind();
            rgGridViewUsers.Rebind();
             
            RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadGrid1, RadScheduler1);
        }
 
 
        private void HandleSchedulerDrop(int id, string subject, string targetSlotIndex)
        {
            RadScheduler1.Rebind();
 
            ISchedulerTimeSlot slot = RadScheduler1.GetTimeSlotFromIndex(targetSlotIndex);
 
            TimeSpan duration = TimeSpan.FromHours(1);
            if (slot.Duration == TimeSpan.FromDays(1))
            {
                duration = slot.Duration;
            }
 
            ScheduleAppointment(id, subject, slot.Start, slot.Start.Add(duration));
        }
 
 private void ScheduleAppointment(int id, string subject, DateTime start, DateTime end)
        {
            IDataSource dataSource = SchedulerDataSource;
            DataSourceView view = dataSource.GetView("DefaultView");
 
            IOrderedDictionary data = new OrderedDictionary();
            data.Add("Subject", subject);
            data.Add("Start", start);
            data.Add("End", end);
 
            IDictionary keys = new OrderedDictionary();
            keys.Add("ID", id);
            //keys.Add("ID", 234);
 
            view.Update(keys, data, new OrderedDictionary(), OnDataSourceOperationComplete);
        }
 
        private static bool OnDataSourceOperationComplete(int count, Exception e)
        {
            if (e != null)
            {
                throw e;
            }
            return true;
        }


However I am trying to add a list of users to the list where the ID column is unique identifier (Guid). After I dropping the even on the scheduler everything seems to work fine up until I get to the the callback OnDataSourceOperationComplete(), where i get an error stating that the key must be of the ienumerbale type.

Here is my code again with the int datatype changed to Guid:
protected void RadGrid1_RowDrop(object sender, GridDragDropEventArgs e)
       {
           GridDataItem dataItem = e.DraggedItems[0];
 
           Hashtable values = new Hashtable();
           dataItem.ExtractValues(values);
            
           Guid id = new Guid((string)values["ID"]);//(int)dataItem.GetDataKeyValue("ID");
           string firstName = (string)values["FirstName"];
           string lastName = (string)values["LastName"];
           string targetSlotIndex = TargetSlotHiddenField.Value;
 
           if (targetSlotIndex != string.Empty)
           {
               HandleSchedulerDrop(id, firstName, targetSlotIndex);
               TargetSlotHiddenField.Value = string.Empty;
           }
           RadScheduler1.Rebind();
           rgGridViewUsers.Rebind();
            
           RadAjaxManager1.AjaxSettings.AddAjaxSetting(RadGrid1, RadScheduler1);
       }
 
 
       private void HandleSchedulerDrop(Guid id, string subject, string targetSlotIndex)
       {
           RadScheduler1.Rebind();
 
           ISchedulerTimeSlot slot = RadScheduler1.GetTimeSlotFromIndex(targetSlotIndex);
 
           TimeSpan duration = TimeSpan.FromHours(1);
           if (slot.Duration == TimeSpan.FromDays(1))
           {
               duration = slot.Duration;
           }
 
           ScheduleAppointment(id, subject, slot.Start, slot.Start.Add(duration));
       }
 
 
private void ScheduleAppointment(Guid id, string subject, DateTime start, DateTime end)
       {
           IDataSource dataSource = SchedulerDataSource;
           DataSourceView view = dataSource.GetView("DefaultView");
 
           IOrderedDictionary data = new OrderedDictionary();
           data.Add("Subject", subject);
           data.Add("Start", start);
           data.Add("End", end);
 
           IDictionary keys = new OrderedDictionary();
           keys.Add("ID", id);
           //keys.Add("ID", 234);
 
           view.Update(keys, data, new OrderedDictionary(), OnDataSourceOperationComplete);
       }
 
       private static bool OnDataSourceOperationComplete(int count, Exception e)
       {
           if (e != null)
           {
               throw e;
           }
           return true;
       }

Unfortunately I am not sure how to overcome this.

Can you provide an example perhaps of how to drag and drop items that have a non integer ID column data type? Or if this is even possible?

Thanks,
-Justin
Boyan Dimitrov
Telerik team
 answered on 09 Jun 2014
1 answer
120 views
We allow our users to choose their colors schemes. I have not found the color property exposed for the header in the RadScheduler. We read the scheme in code behind and adjust accordingly. Can i change this fore color of the header in code-behind?



Thanks!
Magdalena
Telerik team
 answered on 09 Jun 2014
1 answer
120 views
Hi, is it possible to have loading panel shown on export?
Princy
Top achievements
Rank 2
 answered on 09 Jun 2014
6 answers
258 views
Hi,

I have a RadGrid that allows automatic insert and update attached to an ObjectDataSource (ODS). During the ODS insert method I run validation checks and throw custom exceptions. I catch this in my RadGrid ItemInserted event and set the KeepInInsertMode to true and set the ExceptionHandled to true. When the page finishes loading the Insert Row is still there but the values in the edit fields (textboxes, dropdowns, etc) are no longer populated.

Is there a way to keep the values that the user entered before they saved? I need this for Update operations too.

public void RadGrid_Saved(object sender, GridInsertedEventArgs e)  
        {  
            if (e.Exception != null)  
            {  
                e.KeepInInsertMode = true;  
                  
                if (e.Exception.InnerException is ORMEntityValidationException)  
                    e.ExceptionHandled = true;  
            }  
 
        } 

That is how I catch my custom exception to keep the insert mode open.

Thanks!
Angel Petrov
Telerik team
 answered on 09 Jun 2014
3 answers
141 views
Hi.

I'm new using telerik components, and I'm trying to develop something a little bit complicated.

First of all, I have a RadTreeList, that can be editable. I've set the EditMode as "EditForms", and configured the Edit Settings to use a WebUserControl.
My WebUserControl, has 3 fields and a RadGrid, that can be editable too, but this RadGrid is simple, it's the default edit form and I'm just using the Events, InsertCommand, EditCommand and DeleteCommand, to perform this actions in a List who is in 

The first problem here, is that the Cancel command of the RadTreeList is not working, it just works if I comment the RadGrid.
The second problem, is that when I press the Save button in the RadGrid EditForm, it validates all the field from RadTreeList too (attached figure: "Sample.png").

If anyone can help me I'll be very grateful.

Thanks in advance.

jacobi
Top achievements
Rank 1
 answered on 09 Jun 2014
5 answers
117 views
Hi,

I'm having another try to do some basic charts.  These are the issues that I am having:
1) Changing the colour of the chart from the code behind.  How can that be done - I've tried in all kinds of places Page Init, Page Load, Pre Render etc.  Nothing seems to work.
2) Similar to above I have some code working to generate some PlotBands.  All works fine and they are assigned to the chart but they never appear on the chart,
3) In the XAxis I would like to only show the label every x elements so I have the following code:

<XAxis DataLabelsField="ReceivedDate" Step="7">

With the above I see the labels but it doesn't step over 7 labels at a time.

4) I'd like the right most legend panel to be aligned at the top of the right section.  Obviously using top centres it above the chart.  I just want it aligned to the right but at the top. I presume that things like that are CSS hacks for now?

Any pointers gratefully received.

Regards

Jon
Danail Vasilev
Telerik team
 answered on 09 Jun 2014
1 answer
367 views
Hi
how to hide edit button in other rows when one row becomes in edit mode.
Princy
Top achievements
Rank 2
 answered on 09 Jun 2014
2 answers
170 views
The Filter row is word wrapping.  Since I am using AutoGenerateColumns, why doesn't it handle this automatically?  I tried setting the Filter and EditForms Filter styles wrap to False, but it didn't help.

I have attached a screen shot.

Here is my code:
<telerik:RadGrid ID="dgData" runat="server" AllowFilteringByColumn="true" AllowSorting="True" AutoGenerateColumns="True" Skin="Web20" PageSize="500" GridLines="None" Width="945px" AllowPaging="True" TabIndex="-1" EnableEmbeddedSkins="true" OnBiffExporting="RadGrid_BiffExporting" Visible="false" HeaderStyle-Wrap="false">
    <PagerStyle Position="Bottom" Mode="NumericPages" PageButtonCount="10" AlwaysVisible="true" />
    <ClientSettings>
        <Scrolling AllowScroll="True" ScrollHeight="350px" UseStaticHeaders="true"></Scrolling>
        <Resizing ResizeGridOnColumnResize="True" ClipCellContentOnResize="False" />
    </ClientSettings>
    <MasterTableView AllowMultiColumnSorting="True" EnableNoRecordsTemplate="False" GridLines="Vertical" DataKeyNames="ID">
    </MasterTableView>
</telerik:RadGrid>
Peter
Top achievements
Rank 1
 answered on 09 Jun 2014
1 answer
123 views
Hello Can you help me with this question which I have described here


http://stackoverflow.com/questions/24039319/adding-dynamically-itemtemplate-in-radcombobox-inside-radgrid
Boyan Dimitrov
Telerik team
 answered on 09 Jun 2014
1 answer
468 views
Hi,

Apparently I can't format my series tooltips to human readable date using DataFormatString.
I tried {0:d} and many other date formatting but the tooltips always show up as 1399852800000 for example.

My RadHtmlChart/ScatterLine contain multiple ScatterLineSeries added programmatically. Every item X value are DateTime converted to Unix time.
My X-Axis has his Type set to date and apparently format correctly with "yyyy-MM-dd".

Any help?

Thank you.
Danail Vasilev
Telerik team
 answered on 09 Jun 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?