We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to perform the CRUD operation in the Schedule control with WebServices DataSource?

The Schedule control supports the CRUD operations (Create, Read, Update, Delete) by using the Web Services methods.

The following steps help you perform the CRUD operations like adding, editing and deleting actions on the Schedule control by using the web services in the ASP.NET (EJWEB) application.

Step 1: Create the ASP.NET application and include the EJWEB Schedule control in it by referring the following KB link,

http://www.syncfusion.com/kb/3948/how-to-add-the-ejweb-schedule-control-in-the-asp-net-application

Step 2: Create a database table with the necessary fields, as follows.

SQL Table Script

Note: You can create the table through Visual Studio as a local database or by using SQL Server Management Studio.

Step 3: Add the connection String configuration in the Web.Config page. Refer to the following code example.

Web.Config

<configuration>

------------------------------------------

-----------------------------------------------------------------

<connectionStrings>

    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-ScheduleCRUDCS-20150607072453.mdf;Initial Catalog=aspnet-ScheduleCRUDCS-20150607072453;Integrated Security=True"

      providerName="System.Data.SqlClient" />

    <add name="ConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ScheduleData.mdf;Integrated Security=True"

      providerName="System.Data.SqlClient" />

</connectionStrings>

-------------------------------------------

-------------------------------------------

</configuration>

Note: Change the ConnectionString value based on the database connection. Here, the “local database” connection string is mentioned.

Step 4: Create a web service with the CRUD operation functionality using the following steps:

  1. Create a web service by selecting the new item in the solution.

Figure 1: Creation of the webservice

  1. The WebService1.asmx.cs/ WebService1.asmx.vb file opens with the details as shown in the screenshot.

Figure 2: WebService1.asmx.cs/ WebService1.asmx.vb file

  1. Now, add the CRUD operation code to this page.

WebService1.asmx.cs

WebService1.aspx.vb

Step 5: Build the sample and add the WebReference to your application using the following steps,

  1. Right-click Reference and select the Add ServiceReference option as shown in the following screenshot.

Figure 3: Select the Add ServiceReference option

  1. Click Discover to get the created WebServices details.

Figure 4: WebService details

  1. Click the Advanced button and the Service Reference Settings window opens. Select Add Web Reference in that window.

Figure 5: Service Reference Settings window

  1. The Add Web Reference dialog opens as shown in the following screenshot.

Figure 6: Add Web Reference

  1. Select the Web Services in this solution option from the three options, and the available WebServices details are displayed.

Figure 7: WebServices details

  1. Select the WebService (Ex: WebService1) link and it displays the details of the created WebServices with the web reference name. For example, localhost is displayed here.

Figure 8: Details of the created WebServices

  1. Click the Add Reference button and the reference is successfully added to your application.

Figure 9: Reference added

Step 6: Make use of the server-side events of the Schedule control and also map the field names to the Schedule control’s appointmentSettings to perform the CRUD operation.

Default.aspx

Step 7: Define the server-side methods with appropriate functionalities in the code behind the page. Also, call the web service methods within each of the following server-side methods appropriately.

Default.aspx.cs

Default.aspx.vb

Step 8: Run the sample and now you can perform CRUD operations on the schedule appointments that are reflected appropriately in the WebServices too.

Sample Links:

C#:

http://www.syncfusion.com/downloads/support/forum/119417/ze/ScheduleCRUDWithWebServices-728709208

VB:

http://www.syncfusion.com/downloads/support/forum/119417/ze/ScheduleSampleWebServices-617457551

 

Article ID: Published Date: Last Revised Date: Platform: Control:
5182 07/07/2015 08/27/2015 ASP.NET Web Forms Schedule
Tags:
Did you find this information helpful?
Comments
Frederik Gysel Jun 16, 2018

Dear,

This example generates error "The given key was not present in the dictionary." while trying to edit an agenda item on the schedule.


Rgds

Frederik


Reply
Frederik Gysel Jun 16, 2018

string ss = list["Id"].ToString();

Above line trows the error.

Required parameters are in [1] of the dictionary, not in [0].




Reply
Frederik Gysel Jun 16, 2018

How to get the data of [1] in the dictionary?

Reply
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon