Welcome to Mediachase Community Sign in | Join | Help    
in Search   

Binding OwnerDataSource Property With multiple owners

Last post Wed, Oct 22 2008, 2:11 AM by ga. 8 replies.
Sort Posts: Previous Next
  •  Tue, Oct 07 2008, 11:25 PM 10408

    Binding OwnerDataSource Property With multiple owners

    In my application, calendar control is working fine on month and week view mode with below mention code but when I switch to Day view it does not show the activities for each owner.

    When I try to bind "OwnerDataSource" property in DayView calendar mode, the calendar is unable to bind records with respect to particular Owner records. How
    can I bind records in dayview with particular owner set. Please review below sample code:

    Owner Properties:

    calendar.OwnerDataTextField = "Detail";
    calendar.OwnerDataValueField = "Id";

    Sample Code:

    DataView dv = new DataView(dsSchedule.Tables["Activity"]);
    calendar.DataSource = dv;
    calendar.OwnerDataSource = dsSchedule.Tables["Owners"];
    calendar.HolidayDataSource = dsSchedule.Tables["Holidays"];
    calendar.DataBind();

    Thanks In Advance!
  •  Thu, Oct 09 2008, 10:26 AM 10413 in reply to 10408

    Re: Binding OwnerDataSource Property With multiple owners

    Which version of the calendar are you running?

    Mediachase Software
  •  Sun, Oct 12 2008, 9:16 PM 10417 in reply to 10413

    Re: Binding OwnerDataSource Property With multiple owners

    Calendar .Net 2.3
  •  Wed, Oct 15 2008, 2:24 PM 10449 in reply to 10417

    Re: Binding OwnerDataSource Property With multiple owners

    Sorry that it has taken a while for us to respond.  We will get you an answer in a few days, early next week at the latest.

    Mediachase Software
  •  Mon, Oct 20 2008, 5:33 AM 10468 in reply to 10408

    Re: Binding OwnerDataSource Property With multiple owners

    Hi,
    sorry for late reply. Your question is not quite clear. You assign data view as data source and data table as owner data source. What information is stored in tables "Activity" and "Owners"?

    Please read documentation section about calendar.net data binding:
    http://demo.mediachase.com/calendar.net/DataBinding/DataBinding.aspx


     

  •  Mon, Oct 20 2008, 9:02 PM 10474 in reply to 10468

    Re: Binding OwnerDataSource Property With multiple owners

    I need to work with multiple owners; activity datatable contains activity records with respect to different owners in owner’s datatable. When I tried to bind records on calendar owner successfully bind and show different groups in day view mode but activity with respect to owner can’t bind and show the blank calendar.

    Is that clear for you?
  •  Tue, Oct 21 2008, 12:41 AM 10475 in reply to 10474

    Re: Binding OwnerDataSource Property With multiple owners

    Hi,
    has you set "MultiOwner" property to "true"? It is "false" by default.
  •  Tue, Oct 21 2008, 2:20 AM 10476 in reply to 10475

    Re: Binding OwnerDataSource Property With multiple owners

    Yes, it's "TRUE".
  •  Wed, Oct 22 2008, 2:11 AM 10479 in reply to 10408

    Re: Binding OwnerDataSource Property With multiple owners

    Hi,
    your table "Activity" should contain column with owner id for each item. And you should specify calendar "DataOwnerField". Selected date in below example is "09/08/2008", view type is "DayView". Call function "BindMultiOwners" in Page_Load method of your page.

    protected void BindMultiOwners()
    {
    DataTable dtItems = new DataTable();
    dtItems.Columns.Add(
    new DataColumn("ItemId", typeof(int)));
    dtItems.Columns.Add(
    new DataColumn("OwnerId", typeof(int)));
    dtItems.Columns.Add(
    new DataColumn("Title", typeof(string)));
    dtItems.Columns.Add(
    new DataColumn("StartDate", typeof(DateTime)));
    dtItems.Columns.Add(
    new DataColumn("EndDate", typeof(DateTime)));

    DataRow dr = dtItems.NewRow();
    dr[
    "ItemId"] = 1;
    dr["OwnerId"] = 1;
    dr[
    "Title"] = "1 item";
    dr[
    "StartDate"] = new DateTime(2008, 9, 8, 9, 0, 0);
    dr[
    "EndDate"] = new DateTime(2008, 9, 8, 10, 0, 0);
    dtItems.Rows.Add(dr);
    dr = dtItems.NewRow();
    dr[
    "ItemId"] = 2;
    dr[
    "OwnerId"] = 2;
    dr[
    "Title"] = "2 item";
    dr[
    "StartDate"] = new DateTime(2008, 9, 8, 11, 0, 0);
    dr[
    "EndDate"] = new DateTime(2008, 9, 8, 12, 0, 0);
    dtItems.Rows.Add(dr);
    dtItems.AcceptChanges();
    CalendarCtrl.DataTextField =
    "Title";
    CalendarCtrl.DataStartDateField=
    "StartDate";
    CalendarCtrl.DataEndDateField =
    "EndDate";
    CalendarCtrl.DataOwnerField =
    "OwnerId";
    CalendarCtrl.DataSource = dtItems.DefaultView;

    CalendarCtrl.MultiOwner = true;
    DataTable dtOwners = new DataTable();
    dtOwners.Columns.Add(
    new DataColumn("Id", typeof(int)));
    dtOwners.Columns.Add(
    new DataColumn("Details", typeof(string)));
    dr = dtOwners.NewRow();
    dr[
    "Id"] = 1;
    dr[
    "Details"] = "Owner 1 Details";
    dtOwners.Rows.Add(dr);
    dr = dtOwners.NewRow();
    dr[
    "Id"] = 2;
    dr[
    "Details"] = "Owner 2 Details";
    dtOwners.Rows.Add(dr);
    dtOwners.AcceptChanges();
    CalendarCtrl.OwnerDataSource = dtOwners.DefaultView;
    CalendarCtrl.OwnerDataTextField =
    "Details";
    CalendarCtrl.OwnerDataValueField =
    "Id";

    CalendarCtrl.DataBind();

    }

    Hope this helps.  
View as RSS news feed in XML
Site Terms | Privacy Policy | About Us | Contact Us
Running on Mediachase eCommerce Framework 4.0.
  Copyright © Mediachase, LTD. 1997-2006. All Rights Reserved

E-commerce, HelpDesk, Service Desk & Project Management Software, alternatives to Microsoft Project Server & Sharepoint Collaboration Server
project management software | microsoft project server | sharepoint collaboration server | issues management, helpdesk & service desk
Powered by Community Server, by Telligent Systems