Page Index Toggle Pages: 1 [2] 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) Page will be refreshed automatically after item creation/deleting/modification (Read 39242 times)
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #15 - May 15th, 2014 at 7:23pm
Print Post  
Does the calendar control only have one location collection or can have multiple location collection?

Say if I have 100 locations and 10 contacts, contact A has relevant locations from 1-10, contact B has relevant locations from 11-20, etc. So that will very complicated if remove the irrelevant locations. exp: if create new appointment on contact A, we have to remove the irrelevant 90 locations.

That's what I am considering if I could assign relevant location collection to particular contact.

Lyubo wrote on May 9th, 2014 at 7:06am:
Hi,

There's no built-in filter for locations based on contacts, but this behavior can be easily achieved through some DOM manipulation from the FormShow client side event. Before the form is displayed, you can check the item's contact, and then remove the corresponding locations from the locations dropdown control. Here's one way to do this:
Code (Javascript)
Select All
function onFormShow(sender, args) {
    var frm = args.get_form();
    if (frm.getId() == "EditForm") {
        var itemContactId = frm.getItem().contacts[0];
        // The item at 0 index in the location drop-down is the "empty item",
        // so the first location is at index 1, the second at 2, etc.
        if (itemContactId == sender.getContacts()[0].getId()) {
            frm.getControls()["location"].element.remove(1);
        }
        else if (itemContactId == sender.getContacts()[1].getId()) {
            frm.getControls()["location"].element.remove(2);
        }
    }
} 



Regards,
Lyubo

  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #16 - May 15th, 2014 at 11:20pm
Print Post  
Your snippet shows
Code (Javascript)
Select All
var itemContactId = form.getItem().contacts[0];

itemContactId == sender.getContacts()[0].getId()
 


which is the contact that I click on? I think it's
Code (Javascript)
Select All
sender.getContacts()[0].getId() 

Right?

And
Code (Javascript)
Select All
form.getItem().contacts[0] 

is to get the first contact in the contact collection right?

Say on my side the 1st contact, 4th contact, 7th contact and 10th contact are in one group with same location dropdown list, so I try to make their dropdown list equal.

I did
Code (Javascript)
Select All
var itemContactId1 = form.getItem().contacts[0];
                    var itemContactId2 = form.getItem().contacts[3];
                    var itemContactId3 = form.getItem().contacts[6];
                    var itemContactId4 = form.getItem().contacts[9];

 if (itemContactId1 == sender.getContacts()[0].getId()) {
                        form.getControls()["location"].element.remove(1);}

if (itemContactId2 == sender.getContacts()[0].getId()) {
                        form.getControls()["location"].element.remove(1);}

if (itemContactId3 == sender.getContacts()[0].getId()) {
                        form.getControls()["location"].element.remove(1);}

if (itemContactId4 == sender.getContacts()[0].getId()) {
                        form.getControls()["location"].element.remove(1);}
}
 



but still it only affected the first contact. The 4th, 7th, and 10th contacts still have all the locations.

Btw I found that the location collection will adjust itself automatically, so if we want to remove location 1-6, it is not like
Code (Javascript)
Select All
form.getControls()["location"].element.remove(1);
                        form.getControls()["location"].element.remove(2);
                        form.getControls()["location"].element.remove(3);
                        form.getControls()["location"].element.remove(4);
                        form.getControls()["location"].element.remove(5);
                        form.getControls()["location"].element.remove(6); 



but


Code (Javascript)
Select All
form.getControls()["location"].element.remove(1);
                        form.getControls()["location"].element.remove(1);
                        form.getControls()["location"].element.remove(1);
                        form.getControls()["location"].element.remove(1);
                        form.getControls()["location"].element.remove(1);
                        form.getControls()["location"].element.remove(1); 



It confused me for a while.



Lyubo wrote on May 9th, 2014 at 7:06am:
Hi,

There's no built-in filter for locations based on contacts, but this behavior can be easily achieved through some DOM manipulation from the FormShow client side event. Before the form is displayed, you can check the item's contact, and then remove the corresponding locations from the locations dropdown control. Here's one way to do this:
Code (Javascript)
Select All
function onFormShow(sender, args) {
    var frm = args.get_form();
    if (frm.getId() == "EditForm") {
        var itemContactId = frm.getItem().contacts[0];
        // The item at 0 index in the location drop-down is the "empty item",
        // so the first location is at index 1, the second at 2, etc.
        if (itemContactId == sender.getContacts()[0].getId()) {
            frm.getControls()["location"].element.remove(1);
        }
        else if (itemContactId == sender.getContacts()[1].getId()) {
            frm.getControls()["location"].element.remove(2);
        }
    }
} 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #17 - May 16th, 2014 at 1:56pm
Print Post  
Xylon wrote on May 15th, 2014 at 7:23pm:
Does the calendar control only have one location collection or can have multiple location collection?

Say if I have 100 locations and 10 contacts, contact A has relevant locations from 1-10, contact B has relevant locations from 11-20, etc. So that will very complicated if remove the irrelevant locations. exp: if create new appointment on contact A, we have to remove the irrelevant 90 locations.

That's what I am considering if I could assign relevant location collection to particular contact.


The calendar exposes one collection for each type of the resource classes. What you can do in your case, is to inherit from the Contact class and add a Locations resource collection, where you can store the contact-location associations. Creating custom resource classes is discussed in length in this help topic.

Attached to this post you can find a sample that demonstrates how this can be done. There are 100 location and 10 contact objects in the schedule. When a popup form is invoked, the location list is cleared and then repopulated with only the locations associated with the particular contact. It also uses your Separator items from few posts back. Have in mind that the sample doesn't handle cases when items are moved from resource to resource in the view. If this is a valid scenario in your case, you'd need to account for that.


Xylon wrote on May 15th, 2014 at 11:20pm:
Your snippet shows
Code (Javascript)
Select All
var itemContactId = form.getItem().contacts[0];

itemContactId == sender.getContacts()[0].getId()
 


which is the contact that I click on? I think it's
Code (Javascript)
Select All
sender.getContacts()[0].getId() 

Right?

And
Code (Javascript)
Select All
form.getItem().contacts[0] 

is to get the first contact in the contact collection right?


It's the other way around. In the onFormShow handler, the sender variable is actually the calendar object, not the item. So, sender.getContacts() returns all contacts defined in the entire schedule. In the other snippet, form.getItem() - is the item, for which the popup form was invoked, thus form.getItem().contacts[0] is actually the contact that you clicked on.


Xylon wrote on May 15th, 2014 at 11:20pm:
Btw I found that the location collection will adjust itself automatically, so if we want to remove location 1-6
(...)
It confused me for a while.


What happens here, is that when you remove an option element from the select drop-down, your are changing the whole collection - e.g. when you remove the option at index 1, the option that was previously at index 2 is now at index 1, the one at 3 is now 2, etc.

Regards,
Lyubo
  

CustomResource.zip (Attachment deleted)
CustomResources.png (Attachment deleted)
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #18 - May 19th, 2014 at 1:36pm
Print Post  
Awesome, I really appreciate that!

I'll work on my application based on this.

Lyubo wrote on May 16th, 2014 at 1:56pm:
Xylon wrote on May 15th, 2014 at 7:23pm:
Does the calendar control only have one location collection or can have multiple location collection?

Say if I have 100 locations and 10 contacts, contact A has relevant locations from 1-10, contact B has relevant locations from 11-20, etc. So that will very complicated if remove the irrelevant locations. exp: if create new appointment on contact A, we have to remove the irrelevant 90 locations.

That's what I am considering if I could assign relevant location collection to particular contact.


The calendar exposes one collection for each type of the resource classes. What you can do in your case, is to inherit from the Contact class and add a Locations resource collection, where you can store the contact-location associations. Creating custom resource classes is discussed in length in this help topic.

Attached to this post you can find a sample that demonstrates how this can be done. There are 100 location and 10 contact objects in the schedule. When a popup form is invoked, the location list is cleared and then repopulated with only the locations associated with the particular contact. It also uses your Separator items from few posts back. Have in mind that the sample doesn't handle cases when items are moved from resource to resource in the view. If this is a valid scenario in your case, you'd need to account for that.


Xylon wrote on May 15th, 2014 at 11:20pm:
Your snippet shows
Code (Javascript)
Select All
var itemContactId = form.getItem().contacts[0];

itemContactId == sender.getContacts()[0].getId()
 


which is the contact that I click on? I think it's
Code (Javascript)
Select All
sender.getContacts()[0].getId() 

Right?

And
Code (Javascript)
Select All
form.getItem().contacts[0] 

is to get the first contact in the contact collection right?


It's the other way around. In the onFormShow handler, the sender variable is actually the calendar object, not the item. So, sender.getContacts() returns all contacts defined in the entire schedule. In the other snippet, form.getItem() - is the item, for which the popup form was invoked, thus form.getItem().contacts[0] is actually the contact that you clicked on.


Xylon wrote on May 15th, 2014 at 11:20pm:
Btw I found that the location collection will adjust itself automatically, so if we want to remove location 1-6
(...)
It confused me for a while.


What happens here, is that when you remove an option element from the select drop-down, your are changing the whole collection - e.g. when you remove the option at index 1, the option that was previously at index 2 is now at index 1, the one at 3 is now 2, etc.

Regards,
Lyubo

  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #19 - May 19th, 2014 at 6:20pm
Print Post  
Hi another question, it seems if I loop the entire calendar the page will refresh itself?

Code
Select All
foreach (Appointment app in _calendar.Schedule.Items)
                {

                    foreach (Contact c in app.Contacts)
                    {
                        // assgin contact and appointment data to stored procedure
			// do stored procedure
                    }
                } 



I didn't do any postback or refresh it, but once I call the function which has the snippet above, page is refreshed.

The reason why I don't want it getting refreshed is that I would like the page to tell the user "Update successful" after the stored procedure is executed successfully.

The simplest way to do that is if the stored procedure return successful flag "S",
Code
Select All
Response.Write("Update successful"); 



But it doesn't work if the page is refreshed.

Lyubo wrote on May 16th, 2014 at 1:56pm:
Xylon wrote on May 15th, 2014 at 7:23pm:
Does the calendar control only have one location collection or can have multiple location collection?

Say if I have 100 locations and 10 contacts, contact A has relevant locations from 1-10, contact B has relevant locations from 11-20, etc. So that will very complicated if remove the irrelevant locations. exp: if create new appointment on contact A, we have to remove the irrelevant 90 locations.

That's what I am considering if I could assign relevant location collection to particular contact.


The calendar exposes one collection for each type of the resource classes. What you can do in your case, is to inherit from the Contact class and add a Locations resource collection, where you can store the contact-location associations. Creating custom resource classes is discussed in length in this help topic.

Attached to this post you can find a sample that demonstrates how this can be done. There are 100 location and 10 contact objects in the schedule. When a popup form is invoked, the location list is cleared and then repopulated with only the locations associated with the particular contact. It also uses your Separator items from few posts back. Have in mind that the sample doesn't handle cases when items are moved from resource to resource in the view. If this is a valid scenario in your case, you'd need to account for that.


Xylon wrote on May 15th, 2014 at 11:20pm:
Your snippet shows
Code (Javascript)
Select All
var itemContactId = form.getItem().contacts[0];

itemContactId == sender.getContacts()[0].getId()
 


which is the contact that I click on? I think it's
Code (Javascript)
Select All
sender.getContacts()[0].getId() 

Right?

And
Code (Javascript)
Select All
form.getItem().contacts[0] 

is to get the first contact in the contact collection right?


It's the other way around. In the onFormShow handler, the sender variable is actually the calendar object, not the item. So, sender.getContacts() returns all contacts defined in the entire schedule. In the other snippet, form.getItem() - is the item, for which the popup form was invoked, thus form.getItem().contacts[0] is actually the contact that you clicked on.


Xylon wrote on May 15th, 2014 at 11:20pm:
Btw I found that the location collection will adjust itself automatically, so if we want to remove location 1-6
(...)
It confused me for a while.


What happens here, is that when you remove an option element from the select drop-down, your are changing the whole collection - e.g. when you remove the option at index 1, the option that was previously at index 2 is now at index 1, the one at 3 is now 2, etc.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #20 - May 19th, 2014 at 10:18pm
Print Post  
I set the
Code
Select All
_calendar.ResourceViewSettings.BottomTimelineSettings.Unit = TimeUnit.Week;
            _calendar.ResourceViewSettings.BottomTimelineSettings.Format = "ddd,<br />dd MMM"; 



so bottom time line will be week. At this moment each cell stands for Sunday of every week.

Then if I create a new appointment start on Tuesday, end on next Wednesday, see attachment 1 and 2. It appears on the calendar like start on Sunday then end on Sunday. Unless open the detailed window then it will display the exact date.

Is that possible to display the start and end dates partially on the cells?

Such as start on Wednesday and end on Wednesday, which are roughly in the middle of the weeks. Then the appointment bar starts on half of the cell then end on half of the cell?

Btw appreciate again for the sample code above, that's really a genius solution.
  

q21.JPG (Attachment deleted)
q22.JPG (Attachment deleted)
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #21 - May 20th, 2014 at 11:53am
Print Post  
Xylon wrote on May 19th, 2014 at 6:20pm:
Hi another question, it seems if I loop the entire calendar the page will refresh itself?
...


If the AutoPostBack flag is not set, the Calendar won't post the page back by itself. Are you sure you're not refreshing the page by other means - clicking a server button, calling window.__doPostBack? How and when are you calling the above snippet? I don't quite understand where the issue is.

If you're trying to update your database without refreshing the whole page, you can try to implement that via AJAX.

Xylon wrote on May 19th, 2014 at 10:18pm:
Is that possible to display the start and end dates partially on the cells?


Unfortunately, this is not supported by the control at this time. Items always fill the whole view cell. You can workaround this limitation by providing different resolutions for the view, for example. Switch to days or hours as time unit when more precision is needed and then revert back to week units to display a bigger time range.

A simpler solution would be to set the Calendar.ShowToolTips property to true - and show exact items' start and end times via a tooltip. You can adjust the tooltip format via Calendar.ItemTooltipFormat:
Code (HTML)
Select All
<MindFusion:Calendar ID="_calendar" runat="server" Width="800px" Height="300px"
  Theme="Silver" AutoPostBack="false" CurrentView="ResourceView"
  GroupType="GroupByContacts" ShowToolTips="true"
  ItemTooltipFormat="%s[ddd, dd MMM], %s[hh:mm tt] - %e[ddd, dd MMM], %e[hh:mm tt]">
    <ResourceViewSettings BottomTimelineSettings-Unit="Week" BottomTimelineSettings-Format="ddd,<br />dd MMM" />
</MindFusion:Calendar> 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #22 - May 20th, 2014 at 1:53pm
Print Post  
Here is my button

In aspx
Code
Select All
<asp:Button ID="btnSave" runat="server" Text="Update To Database" CssClass="button"
                            OnClick="btnUpload_Click" />


<MindFusion:Calendar ID="_calendar" runat="server" Height="490px" Width="100%" Theme="Vista"
					CurrentView="ResourceView" Culture="(Default)"  AutoPostback ="false"
                         GroupType="GroupByContacts"
                            ItemCreatingScript="itemCreating" ItemModifyingScript="itemModifying"
                                  CalendarLoadScript="onCalendarLoad"
                                FormShowScript="formShow" ItemDeletingScript="ConfirmDelete" >

 



In aspx.cs
Code
Select All
protected void btnUpload_Click(object sender, EventArgs e)
        {

            foreach (Appointment app in _calendar.Schedule.Items)
            {
                foreach (Contact c in app.Contacts)
                {
                    if (!c.Tag.Equals("Separator"))
                    {
			//

                        //doSched(pass varibles here);

                    }
                }
            }

        }

private void doSched(define variables); 



Even I removed doSched function only left the two foreach to loop the calendar, once button was clicked, page was refreshed




Lyubo wrote on May 20th, 2014 at 11:53am:
Xylon wrote on May 19th, 2014 at 6:20pm:
Hi another question, it seems if I loop the entire calendar the page will refresh itself?
...


If the AutoPostBack flag is not set, the Calendar won't post the page back by itself. Are you sure you're not refreshing the page by other means - clicking a server button, calling window.__doPostBack? How and when are you calling the above snippet? I don't quite understand where the issue is.

If you're trying to update your database without refreshing the whole page, you can try to implement that via AJAX.

Xylon wrote on May 19th, 2014 at 10:18pm:
Is that possible to display the start and end dates partially on the cells?


Unfortunately, this is not supported by the control at this time. Items always fill the whole view cell. You can workaround this limitation by providing different resolutions for the view, for example. Switch to days or hours as time unit when more precision is needed and then revert back to week units to display a bigger time range.

A simpler solution would be to set the Calendar.ShowToolTips property to true - and show exact items' start and end times via a tooltip. You can adjust the tooltip format via Calendar.ItemTooltipFormat:
Code (HTML)
Select All
<MindFusion:Calendar ID="_calendar" runat="server" Width="800px" Height="300px"
  Theme="Silver" AutoPostBack="false" CurrentView="ResourceView"
  GroupType="GroupByContacts" ShowToolTips="true"
  ItemTooltipFormat="%s[ddd, dd MMM], %s[hh:mm tt] - %e[ddd, dd MMM], %e[hh:mm tt]">
    <ResourceViewSettings BottomTimelineSettings-Unit="Week" BottomTimelineSettings-Format="ddd,<br />dd MMM" />
</MindFusion:Calendar> 



Regards,
Lyubo
  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #23 - May 20th, 2014 at 2:00pm
Print Post  
The page is refreshed by the button. It is the default ASP.NET Button click behavior. If you wish to update your database without refreshing the whole page, try to do that with AJAX.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #24 - May 20th, 2014 at 2:11pm
Print Post  
Okay, I'll work on this today.

Thank you

Lyubo wrote on May 20th, 2014 at 2:00pm:
The page is refreshed by the button. It is the default ASP.NET Button click behavior. If you wish to update your database without refreshing the whole page, try to do that with AJAX.

Regards,
Lyubo

  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #25 - May 21st, 2014 at 10:08pm
Print Post  
Hi, how are you? I have three questions. haha

Q1: Say now create another page which contains four calendar control, calendar 1-4. They will display the schedule group by contacts. Now I have a function will add schedules to the calendars from database.
exp:
Code
Select All
private void (datatable dt, string xxx, string yyy)
{
    //do sth
}
 



If I only have one calendar control, so I could simply use the calendar in the function. But at this moment I have four, what I did this afternoon was calling the function four times to execute the four calendar control.

I tried like
Code
Select All
private void (Calendar cal, datatable dt, string xxx, string yyy)
{
    //do sth
}
 



but I couldn't define
Code
Select All
Calendar cal 

like that to pass a calendar into this function.

Well, execute the function four times with particular calendar is not tough but I am wondering if there is any way that could have a such as calendar collection containing multiple calendar control.

Q2.

As I said above now I have several groups of contacts, on my main page there is only one calendar control which will display all the schedule with their contacts.

As we know in contact class we have firstname and lastname as contact member, so I put group name as the firstname then the real contact name as lastname, which looks like:
group1 contact1
group1 contact2
group1 contact3
group2 contact1
group2 contact2
group2 contact3
group3 contact1
group3 contact2
group3 contact3

I am considering make a javascript accordion so that if user select "minimal view" foreach control on page, the calendar display only group name or group name with contact1, no contact2 nor contact3. Kind of expanding and collapse.

exp: (after collapse)
group1 contact1
group2 contact1
group3 contact1

Ref:
http://jqueryui.com/accordion/

http://www.1stwebdesigner.com/freebies/jquery-accordion-menus-tutorials/

http://www.dhtmlx.com/docs/products/dhtmlxAccordion/index.shtml

Could you please give me some hint on how to implement snippet to the calendar control?

Q3.

I have a button on page that user could click on to save the calendar data to database. I am trying to add a condition check which will check whether the calendar schedule has been modified or not. If the calendar has been modified yet then enable the button to update data to database, otherwise disable the button because there is no change then tell the user "There is no change" or "Calendar data is already updated".

My idea is set a static boolean variable in code behind, by default it is false. Once the calendar control has been modified then set the variable to true, below is the code behind button OnClick function
Code
Select All
        private void btnUpload_Click(object sender, EventArgs e)
        {
            if (flag)
            {
                foreach (Appointment app in _calendar.Schedule.Items)
                {
                    foreach (Contact c in app.Contacts)
                    {
                        //assgin data to stored procedure
                    }
                }

                flag = flase;
            }
        }
 



But I really have no idea how the set
Code
Select All
flag = true 


once the Calendar control has been modified(edit/delete/create/move...etc)

Thank you a tons.

Lyubo wrote on May 20th, 2014 at 2:00pm:
The page is refreshed by the button. It is the default ASP.NET Button click behavior. If you wish to update your database without refreshing the whole page, try to do that with AJAX.

Regards,
Lyubo
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #26 - May 26th, 2014 at 7:35am
Print Post  
Hi,

Quote:
but I couldn't define Code:Calendar cal like that to pass a calendar into this function.


Are you getting a compilation error for undefined Calendar class? In such case add a "using MindFusion.Scheduling.WebForms" statement to the top of code-behind file.

Quote:
Could you please give me some hint on how to implement snippet to the calendar control?


You could implement that by adding an extra 'group'contact to each item, removing individual contacts from Calendar.Contacts when collapsing and adding the groups in their place, then adding individual contacts back (from Schedule.Contacts) when expanding and removing the 'group' contacts.

Quote:
But I really have no idea how the set Code:flag = true


You could set the flag from event handlers such as ItemModified, ItemCreated and ItemDeleted.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #27 - May 27th, 2014 at 7:04pm
Print Post  
Question 1 I think if I have multiple calendar controls in one page, I have to work on them individually. But that doesn't matter.

Question 2, yes you are right, I forget that I could use contact group to achieve my goal, hopefully I could complete that, otherwise I'll let you know my problem.

Question 3, I'll figure out that, maybe use ajax.

Thank you!

Stoyo wrote on May 26th, 2014 at 7:35am:
Hi,

Quote:
but I couldn't define Code:Calendar cal like that to pass a calendar into this function.


Are you getting a compilation error for undefined Calendar class? In such case add a "using MindFusion.Scheduling.WebForms" statement to the top of code-behind file.

Quote:
Could you please give me some hint on how to implement snippet to the calendar control?


You could implement that by adding an extra 'group'contact to each item, removing individual contacts from Calendar.Contacts when collapsing and adding the groups in their place, then adding individual contacts back (from Schedule.Contacts) when expanding and removing the 'group' contacts.

Quote:
But I really have no idea how the set Code:flag = true


You could set the flag from event handlers such as ItemModified, ItemCreated and ItemDeleted.

I hope that helps,
Stoyan

  
Back to top
 
IP Logged
 
Xylon
Junior Member
**
Offline


I Love MindFusion!

Posts: 96
Joined: Feb 17th, 2014
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #28 - May 27th, 2014 at 8:39pm
Print Post  
Well one question is, say I have 9 contacts, 1-3  belongs to group 1, 4-6  belongs to group 2, then 7-9 belongs to group 3. Then what if I wanna set a group list/textbox then the user could select particular group to display?

Yes I can retrieve selected contacts from a contact list then display them via a "GroupBy_Click", that means the 9 contacts will be appearing in the list.

Then how about group 1, 2, and 3 appear in the list so that the user could select particular group to display?


And, as we discussed above,  if I set the flag from event handlers such as ItemModified, ItemCreated and ItemDeleted in javascript, then it will respond to the back server after every interaction to change the flag, this will refresh the entire page like a postback. That will cause the calendar very slow. Any other suggestion?

Thank you!

Stoyo wrote on May 26th, 2014 at 7:35am:
Hi,

Quote:
but I couldn't define Code:Calendar cal like that to pass a calendar into this function.


Are you getting a compilation error for undefined Calendar class? In such case add a "using MindFusion.Scheduling.WebForms" statement to the top of code-behind file.

Quote:
Could you please give me some hint on how to implement snippet to the calendar control?


You could implement that by adding an extra 'group'contact to each item, removing individual contacts from Calendar.Contacts when collapsing and adding the groups in their place, then adding individual contacts back (from Schedule.Contacts) when expanding and removing the 'group' contacts.

Quote:
But I really have no idea how the set Code:flag = true


You could set the flag from event handlers such as ItemModified, ItemCreated and ItemDeleted.

I hope that helps,
Stoyan

  
Back to top
 
IP Logged
 
Lyubo
God Member
*****
Offline


MindFusion team

Posts: 511
Joined: Jun 17th, 2010
Re: Page will be refreshed automatically after item creation/deleting/modification
Reply #29 - May 28th, 2014 at 11:45am
Print Post  
Hi,

Q1: Do you mean you need to access the different Calendar control instances on the page from the code-behind? If so, the name of the variable is the control's ID. So if you have in aspx:
Code (HTML)
Select All
<MindFusion:Calendar ID="Calendar1" runat="server" ... />
<MindFusion:Calendar ID="Calendar2" runat="server" ... />
<MindFusion:Calendar ID="Calendar3" runat="server" ... /> 


you can access these calendars in aspx.cs with Calendar1, Calendar2, Calendar3 respectively.

You can check the attached sample for an example. There are two calendars on the page - one main resource view and a small single month view. By selecting a date in the small calendar, you can adjust the starting date of the resource schedule.

Q2: As Stoyo suggested, you can add "Group Master" contact objects to the calendar's schedule and associate the appointments not only with the "child" contact, but also with the group "master".

I.e. if you have an item for "Group 2 Contact 3" -> you'll add both the Contact instance for "Group 2 Contact 3" and it's "master" "Group 2" to the Item.Contacts collection. Then, when you need to collapse a group, you'll remove all of the "children" contacts for the group from the Calendar.Contacts collection and add the group "master" instance there. To show the the "children" -> you'll do the reverse - remove the "master" from the collection, and re-add the "children".

In the attached sample there's a simple implementation of this concept. There are three checkboxes on the page, that can be used to toggle a group's collapsed state. There's also an attached image that shows the final result.

Q3: You can set your "Update database" button to a disabled state initially, and then from the client-side ItemCreated, ItemModified and ItemDeleted event handlers, you can enable it back. That way you can postback only when there has been a change in the schedule.

The attached sample demonstrates this also.

Regards,
Lyubo
  

ContactGroups.png (Attachment deleted)
ContactGroups.zip (Attachment deleted)
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
Send TopicPrint