1. Create a class, which represents an appointment. Here it is named CustomEvent. Add required public properties, which will be mapped to corresponding appointment properties.
2. Create a class responsible for data processing - CustomDataSource. It implements update, insert, select and delete methods. The select method should return an object of the BindingList type to ensure a correct operation.
3. Add the ObjectDataSource component to the page by dragging and dropping it from the Toolbox.
4. Assign the values to ObjectDataSource properties, as follows:
- DataObjectTypeName="CustomEvent"
- TypeName="CustomDataSource"
- InsertMethod, UpdateMethod, DeleteMethod and SelectMethod properties – specify the corresponding methods of the CustomDataSource class.
5. In the Page_Load event procedure, specify mappings, assign the ObjectDataSource as the appointment's data source, and call the ASPxScheduler’s DataBind method
To make the project simple and easy-to-use, data is written into a session. To accomplish this, the CustomEventList : BindingList class is implemented. It has several helper methods, and is marked with a Serializable attribute. It eliminates the need for an external data source since all data is stored in a session. Note that all data will be lost when a session is closed (usually it happens when the browser window is closed).
When a page is reloaded, the ObjectCreated event of the ObjectDataSource component is raised. This event is handled to load the previously saved appointments from within the session. When a new CustomDataSource object is created, it gets a CustomEventList collection, which contains a list of appointments.
Note that each appointment must have a unique identifier. Otherwise, the client-server interaction fails. So, the need to assign a unique ID to newly created appointments is evident. Since editing an appointment actually involves its re-creation, the same requirement is applied to edited appointments. To accomplish a unique ID assignment, use the AppointmentInserting event of the ASPxScheduler control. The appointment's object hash function provides the necessary unique value.
1. Create a class, which represents an appointment. Here it is named CustomEvent. Add required public properties, which will be mapped to corresponding appointment properties.
2. Create a class responsible for data processing - CustomDataSource. It implements update, insert, select and delete methods. The select method should return an object of the BindingList type to ensure a correct operation.
3. Add the ObjectDataSource component to the page by dragging and dropping it from the Toolbox.
4. Assign the values to ObjectDataSource properties, as follows:
- DataObjectTypeName="CustomEvent"
- TypeName="CustomDataSource"
- InsertMethod, UpdateMethod, DeleteMethod and SelectMethod properties – specify the corresponding methods of the CustomDataSource class.
5. In the Page_Load event procedure, specify mappings, assign the ObjectDataSource as the appointment's data source, and call the ASPxScheduler’s DataBind method
To make the project simple and easy-to-use, data is written into a session. To accomplish this, the CustomEventList : BindingList class is implemented. It has several helper methods, and is marked with a Serializable attribute. It eliminates the need for an external data source since all data is stored in a session. Note that all data will be lost when a session is closed (usually it happens when the browser window is closed).
When a page is reloaded, the ObjectCreated event of the ObjectDataSource component is raised. This event is handled to load the previously saved appointments from within the session. When a new CustomDataSource object is created, it gets a CustomEventList collection, which contains a list of appointments.
Note that each appointment must have a unique identifier. Otherwise, the client-server interaction fails. So, the need to assign a unique ID to newly created appointments is evident. Since editing an appointment actually involves its re-creation, the same requirement is applied to edited appointments. To accomplish a unique ID assignment, use the AppointmentInserting event of the ASPxScheduler control. The appointment's object hash function provides the necessary unique value.
การแปล กรุณารอสักครู่..
![](//thimg.ilovetranslation.com/pic/loading_3.gif?v=b9814dd30c1d7c59_8619)