| protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) |
| { |
| // Get edited row |
| GridEditableItem editedItem = e.Item as GridEditableItem; |
| // Get primary key of editted item |
| object dataKey = editedItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ProviderUserKey"]; |
| //Locate the changed row in the data source |
| MembershipUser liveUser = membershipProvider.GetUser(dataKey, false); |
| // Check if user still exists in data source |
| if (liveUser == null) |
| { |
| statusLabel.Text += "Unable to locate the user for updating."; |
| e.Canceled = true; |
| return; |
| } |
| // Update new values |
| Hashtable newValues = new Hashtable(); |
| // The GridTableView will fill the values from all editable columns in the hash |
| editedItem.OwnerTableView.ExtractValuesFromItem(newValues, editedItem); |
| try |
| { |
| // Update user object with form data |
| liveUser.Email = (string)newValues["Email"]; |
| membershipProvider.UpdateUser(liveUser); |
| statusLabel.Text += "User " + liveUser.UserName + " updated."; |
| } |
| catch (Exception ex) |
| { |
| statusLabel.Text += "Unable to update user. Reason: " + ex.Message + "."; |
| e.Canceled = true; |
| } |
| // Refresh grid view data |
| RadGrid1.Rebind(); |
| } |
I am attempting to use the ResourceView of the RadScheduler to show me the Appointments for specific resources. I have specified that the ForeignKey for the ResourceMapping is the ResourceID field which is a CustomAttribute of the Appointment object. I have verified that the data for the ResourceID field is being correctly populated in the Appointment and I have also verified that the resources are being bound to the control. My question is this: when I try to use the ResourceView, I can see the resources, but none of the Appoinments that use those Resources. Am I missing something for the relationship between these two to make this work? Below is the code(s) I am using to establish the relationship:
| <ResourceTypes> |
| <telerik:ResourceType |
| ForeignKeyField="ResourceID" |
| DataSourceID="odsResources" |
| Name="Route" |
| KeyField="Id" |
| TextField="RouteName" /> |
| </ResourceTypes> |
| appts = new List<TelerikAppointment>(); |
| foreach (Schedule s in schedules) |
| { |
| temp = new Appointment(); |
| temp.Attributes["ResourceID"] = s.Route.Id.ToString(); |
| temp.Attributes["MobilityID"] = s.Appointment.Mobility.Id.ToString(); |
| temp.Attributes["FromID"] = s.Appointment.FromAddress.Id.ToString(); |
| temp.Attributes["ToID"] = s.Appointment.ToAddress.Id.ToString(); |
| temp.End = s.EndTime; |
| temp.ID = s.Id; |
| temp.Start = s.StartTime; |
| temp.Subject = s.Description; |
| appts.Add(temp); |
| } |
| this.RadScheduler1.DataSource = appts; |
| CustomAttributeNames="ResourceID,MobilityID,FromID,ToID" |
| DataEndField="End" |
| DataKeyField="ID" |
| DataStartField="Start" |
| DataSubjectField="Subject" |
| DayEndTime="22:00:00" |
| DayStartTime="05:00:00" |
| EnableCustomAttributeEditing="true" |
| FirstDayOfWeek="Sunday" |
| GroupBy="Route" |
To get familiar in a fast and pretty straight-forward manner with our panelbar control, I suggest that you visit the online resources linked below:
Of course, you can browse the public forum as well to find a specific information/code sample concerning an aspect of the panelbar object model/ features. There are numerous threads which can get you started/assist you through the development process.
Finally, we will appreciate your feedback on the structure/content of the online resources - our goal is to continue enriching them, thus facilitating our customers even more.
<
asp:DropDownList runat="server" ID="UserDropDown" AutoPostBack="true" DataSourceID="SqlDataSource1" DataTextField="TaskType" DataValueField="ID" OnDataBound="UserDropDown_DataBound">
</asp:DropDownList>
<telerik:radscheduler runat="server" id="RadScheduler1" width="100%" daystarttime="08:00:00" dayendtime="08:01:00" readonly="true" allowdelete="True" allowedit="True" allowinsert="True" dataendfield="End" datakeyfield="ID" onappointmentinsert="RadScheduler1_AppointmentInsert"
<ResourceTypes>
And i tried in Serverside also:
Private
Sub InitializeResources()
Dim resType As New ResourceType("TaskType")
resType.DataSourceID = "SqlDataSource1"
resType.ForeignKeyField = "ID"
resType.KeyField = "ID"
resType.TextField = "TaskType"
RadScheduler1.ResourceTypes.Add(resType)
RadScheduler1.Resources.Add(New Resource("TaskType", 1, "Expert"))RadScheduler1.Resources.Add(New Resource("TaskType", 9001, "Meeting"))RadScheduler1.Resources.Add(New Resource("TaskType", 90, "Staff"))RadScheduler1.Resources.Add(New Resource("TaskType", 92, "National Expert"))
End Sub
The types that i'm filling with the combo are 5 types. Appointment should be one of the 5 types.
| <telerik:GridBoundColumn |
| DataField="Price" |
| HeaderText="Price" |
| DataFormatString="${0:###,###.##}" |
| FooterText="Sub-Total: $" |
| Aggregate="sum"> |
| </telerik:GridBoundColumn> |