Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
119 views
Is it possible to collapse (or expand) a group based on the Group's FieldName property?

I have the following in my PreRender function, but it just collapses all groups:

foreach (var gi in rgVendorInvItems.MasterTableView.GetItems(GridItemType.GroupHeader))
{
     gi.SetChildrenVisible(false);
}

Any input would be greatly appreciated!
AJ
Top achievements
Rank 2
 answered on 20 Feb 2012
4 answers
394 views
Hi Telerik Support,

I have created a list of checkbox controls within Radmenu from code-behind with one root node and a list of menu-items directly under this root node with 3 columns - see attachment.  

Test.aspx
<telerik:RadMenu runat="server" ID="RadMenu1" Skin="Vista"
   DataFieldID="ItemId" DataFieldParentID="ParentItemId"
    DataValueField="ItemId" DataTextField="Text" OnClientLoad="OnClientMenuLoaded">
    <DefaultGroupSettings RepeatColumns="3" RepeatDirection="Vertical" />
      </telerik:RadMenu>

Test.aspx.cs
namespace WebApplication1
{
    public partial class ListViewIn_Menu : System.Web.UI.Page
    {
        protected override void OnInit(EventArgs e)
        {
            RadMenu1.ItemTemplate = new TextBoxTemplate();
            base.OnInit(e);
        }
 
 
        protected void Page_Load(object sender, EventArgs e)
        {
               //Construct source list to bind to Menu
                List<MenuSelection> lstV = new List<MenuSelection>();
                MenuSelection lstItm;
                for(int i = 1; i<= 50 ; i++)
                {
                    if (lstV.Count == 0)
                    {
                        lstItm = new MenuSelection();
                        lstItm.ParentItemId = 0;
                        lstItm.ItemId = lstV.Count + 1;
                        lstItm.Checked = false;
                        lstItm.Text = "MenuLevel1";
                    }
                    else
                    {
                        lstItm = new MenuSelection();
                        lstItm.ItemId = lstV.Count + 1;
                        lstItm.ParentItemId = 1;
                        lstItm.Checked = GetSelectedList().Contains(lstItm.ItemId);
                        lstItm.Text = "MenuLevel2_" + (lstV.Count + 1).ToString();
                    }
                    lstV.Add(lstItm);
                }
 
                RadMenu1.DataSource = lstV;
                RadMenu1.DataBind();
 
 
 
        }
 
 
        private List<int> GetSelectedList()
        {
            //Get the selected checkbox text from hidden field (where checkbox is checked)
            List<int> selList = new List<int>();
            foreach (string itm in hidSelectedList.Value.Split(new char[] { '|' }))
            {
                if (!string.IsNullOrEmpty(itm))
                {
                    selList.Add(Convert.ToInt32(itm));
                }
            }
 
            return selList;
        }
 
    }
 
    public class MenuSelection
    {
        public MenuSelection()
        {
        }
 
        public int ItemId { get; set; }
 
        public int ParentItemId { get; set; }
 
        public string Text { get; set; }
 
        public bool Checked { get; set; }
    }
 
    class TextBoxTemplate : ITemplate
    {
        public void InstantiateIn(Control container)
        {
            CheckBox cb = new CheckBox();
            cb.DataBinding += new EventHandler(cb_DataBinding);
            container.Controls.Add(cb);
        }
 
        void cb_DataBinding(object sender, EventArgs e)
        {
            CheckBox target = (CheckBox)sender;
            RadMenuItem item = (RadMenuItem)target.BindingContainer;
            MenuSelection ds = (MenuSelection)item.DataItem;
            target.Checked = ds.Checked;
            target.Text = ds.Text;
            target.ID = "ck";
            target.Attributes.Add("onclick", "OnMenuCheck_Click('" + ds.ItemId.ToString() + "')");
             
        }
    }

My issue is:- 
a) how can I use javascript to read all the text from checkbox (checked) and build a string store in hidden field so that I can access from code-behind.

b) When I check on the root node, all child-nodes will get checked. How to use javascript to read each checkbox in RadMenu?

c) I may add one hidden field together with checkbox in RadMenu then how to read this hidden field's value?

d) You have better way of presenting this design using other control?

I can use normal javascript to read them E.g. alert($get('RadMenu1_i0_i0_ck2').checked); But can I use the method provided by Telerik framework? I afraid this naming format may change in future by Telerik product upgrade. I have tried other methods provided in help file and from this forum with no help.

Anyone can help? Thanks in advanced.
PS
Tan PS
Top achievements
Rank 1
 answered on 20 Feb 2012
0 answers
96 views
I have a Rad tree view inside a RadGrid. The RadTree dissapears when the page is run in Quirks mode in IE. What should I do??

HELP!!!!!

Naupad
Top achievements
Rank 1
 asked on 20 Feb 2012
3 answers
150 views

I have a requirement in which I need to hide the recurrence check box form the Edit Appointment dialog. I wonder if this is possible

Thank you

J

Jose
Top achievements
Rank 1
 answered on 20 Feb 2012
4 answers
193 views
Hi;

I am trying to create a custom scheduler modules for our application, I only want to user the RadSchedulerRecurrenceEditor as you can see in the following code snippet and the image provided. I need to make sure that the Recurrence check box is always checked and its visibility is set to hidden, however I have not been able to come up with a solution to this issue yet. Would you please help me with this issue as I need to get started on this development soon. 

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<asp:Panel ID="pnlDefaultButtonSupport" runat="server" DefaultButton="btnOk">
 
<fieldset class="noborder" style="width: 780px;">
        <telerik:RadSchedulerRecurrenceEditor runat="server" ID="rscr">
    </telerik:RadSchedulerRecurrenceEditor>  
</fieldset>
 
<div class="ActionContainerNoBottom" style="width: 780px">
    <asp:Button ID="btnOk" runat="server" Text="Save" SkinID="CommandButton"/>  
    <asp:Button ID="btnClose" runat="server" Text="Close" PostBackUrl="javascript:GetRadWindow().close();" SkinID="CommandButton" CausesValidation="false"/>
</div>
</asp:Panel>

Thanks;
Jose
Top achievements
Rank 1
 answered on 20 Feb 2012
6 answers
266 views
I have a Scheduler where I need to disable the Recurrence Dialog when the User Clicks on an Appointment to edit it.  I still want to show the edit dialog but not the "Do you want to edit this instance or all instances" of Appointment dialog. 

Thanks!
Rhys
Jose
Top achievements
Rank 1
 answered on 20 Feb 2012
2 answers
216 views
Hi there,

I'm working on an app that has a RadWindowManager on a master page. This is used to open some detail windows in a non-modal way, which also updates a count of open windows, which can be re-opened, blah blah blah.

The issue occurs when a modal window is opened (via radopen) from a widget placed on the page, which uses the Master Page's RadWindowManager by design, and the window is set modal via script. The user continues their work, closes the window, and everything's fine.

However, the next time the user opens the detail window, it is now modal, despite being explicitly set to non-modal via set_modal(false). In fact, the window itself reports isModal == false, but is still displayed modally.

The RadWindowManager (on the Master page) is as follows:

<telerik:RadWindowManager ID="rwmRecord" runat="server" Height="500" Width="900"
    ShowOnTopWhenMaximized="false" Behaviors="Close,Move,Resize,Maximize,Reload,Minimize"
    ReloadOnShow="true" ShowContentDuringLoad="false" VisibleStatusbar="false" EnableShadow="true"
    OnClientClose="OnClientClose" OnClientCommand="OnClientCommand">

Any thoughts?
Mike
Top achievements
Rank 1
 answered on 20 Feb 2012
6 answers
351 views
Hello.

I have been developing a web application that accesses the database via web service.
In order to block time slots of the RadScheduler component, I have implemented the following method, which is associated with event OnTimeSlotCreated:
protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
{     
    // checking if the current time slot is blocked
    if (TimeSlotBlocked(e.TimeSlot.Resource.Key.ToString(), e.TimeSlot.Start, e.TimeSlot.End))
    {
        e.TimeSlot.CssClass = "Disabled";            
    }                                 
}

Method TimeSlotBlock checks if the resource is blocked for the start and end times provided:
protected bool TimeSlotBlocked(String pt, DateTime dt1, DateTime dt2)
{
    foreach (PTBlockedTime bt in blockedTime)
    {
        if ((pt == bt.PersonalTrainerId) && ((dt1.AddMinutes(+1) >= bt.Start && dt1.AddMinutes(+1) <= bt.End) || (dt2.AddMinutes(-1) >= bt.Start && dt2.AddMinutes(-1) <= bt.End)))
        {
            return true;
        }
    }
    return false;
}

blockedTime is a list of blocked times:
public struct PTBlockedTime
{
    public String PersonalTrainerId;
    public DateTime Start;
    public DateTime End;
  
    public PTBlockedTime(String pt, DateTime dt1, DateTime dt2)
    {
        PersonalTrainerId = pt;
        Start = dt1;
        End = dt2;
    }
}
.
.
.
List<PTBlockedTime> blockedTime = new List<PTBlockedTime>();

For testing purposes, I have loaded blockedTime on Page_Load:
DateTime aux1 = new DateTime(2012, 1, 25, 8, 0, 0);
DateTime aux2 = new DateTime(2012, 1, 25, 10, 0, 0);
PTBlockedTime aux = new PTBlockedTime("575204", aux1, aux2);
blockedTime.Add(aux);
This list item indicates that resource "575204" is blocked from 08:00 AM to 10:00 AM on 01/25/2012.


This solution works only partially for two reasons:

1) Method TimeSlotCreated is not called when the calendar date changes. Although in the code above the resource is blocked only on 01/25/2012, all dates will have the time slots blocked from 8 to 10.
Is there a way to solve this problem?

2) Instead of Page_Load, the routine that populates the list of blocked times needs to be called every time the calendar date changes. This is required because the time resources are blocked varies on a daily basis. On one day, a resource might be blocked from 8 to 10 AM. On another day, from 5 to 7 AM. And in another day, not blocked at all.
How can the list of blocked times be populated every time the calendar date changes?

Thank you in advance.
Paulo

Plamen
Telerik team
 answered on 20 Feb 2012
34 answers
410 views
When I call the ExportToPdf() function for my scheduler widget, I get the following error. Anyone aware of what that could be?

System.ArgumentException: Parameter is not valid.
at System.Drawing.Bitmap..ctor(Stream stream)
at Telerik.Web.Apoc.Image.ApocImage..ctor(String href, Byte[] imageData)
at Telerik.Web.Apoc.Image.ApocImageFactory.Make(String href)
at Telerik.Web.Apoc.Fo.Flow.ExternalGraphic.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.SystemException: System.ArgumentException: Parameter is not valid.
at System.Drawing.Bitmap..ctor(Stream stream)
at Telerik.Web.Apoc.Image.ApocImage..ctor(String href, Byte[] imageData)
at Telerik.Web.Apoc.Image.ApocImageFactory.Make(String href)
at Telerik.Web.Apoc.Fo.Flow.ExternalGraphic.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)
Helen
Telerik team
 answered on 20 Feb 2012
4 answers
129 views
Hi

I am new to Telerik and I am working with the scheduler and want recurring appointments.
I am using the standard advanced insert and then hooking into the oninsert event and adding them to the database but I am only seeing the appointment once in the scheduler.
I have found in the forum about the \r\n for the new lines and have tried adding this but it doesn't seem to make any difference but can't seem to find anything else.

Can anyone see what I am doing wrong?

I am adding appointments like this:

protected void RadScheduler1_AppointmentInsert(object sender, SchedulerCancelEventArgs e)
       {
           //add the new appointment to the db
 
           int? recurrentParentId = null;
           if (e.Appointment.RecurrenceParentID != null) recurrentParentId = (int)e.Appointment.RecurrenceParentID;
           AppointmentManager.AddUserAppointment(
               UserId,
               1,
               e.Appointment.Start,
               e.Appointment.End,
               e.Appointment.RecurrenceRule,
               recurrentParentId,
               e.Appointment.Description,
               e.Appointment.Subject);
           BindSchedule();
       }


I am then binding the scheduler like this:
mySchedule.DataSource = GetSchedule(); //calls the database and gets the appointments
mySchedule.DataBind();

This is my scheduler markup is:
<telerik:RadScheduler runat="server" ID="mySchedule" DayStartTime="08:00:00" DayEndTime="22:00:00"
    StartInsertingInAdvancedForm="true" ShowNavigationPane="true" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
    OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnAppointmentDelete="RadScheduler1_AppointmentDelete"
    DataKeyField="AppointmentId" DataSubjectField="Subject" DataDescriptionField="Description"
    DataStartField="Start" DataEndField="EndX" DataRecurrenceField="RecurrenceRule"
    DataRecurrenceParentKeyField="RecurrenceParentId" FirstDayOfWeek="Monday" ShowHeader="true"
    ShowFooter="false">
    <AdvancedForm Modal="true" />
    <DayView UserSelectable="false" />
    <WeekView UserSelectable="false" />
    <MonthView UserSelectable="false" />
    <TimeSlotContextMenuSettings EnableDefault="true" />
    <AppointmentContextMenuSettings EnableDefault="true" />
    <ResourceTypes>
        <telerik:ResourceType KeyField="ID" Name="Type" TextField="Keyword" ForeignKeyField="AppointmentTypeID"
            DataSourceID="AppointmentTypesDataSource" />
    </ResourceTypes>
    <ResourceStyles>
        <telerik:ResourceStyleMapping Type="Type" Text="Event" ApplyCssClass="rsCategoryGreen" />
                <telerik:ResourceStyleMapping Type="Type" Text="Personal" ApplyCssClass="rsCategoryBlue" />
        <telerik:ResourceStyleMapping Type="Type" Text="Meeting" ApplyCssClass="rsCategoryYellow" />
    </ResourceStyles>
    <AppointmentTemplate>
               <!--narrowed down template-->
        <div >
            <h2>
                <%# Eval("Subject") %>
            </h2>
            <div>
            </div>
        </div>
        
    </AppointmentTemplate>
</telerik:RadScheduler>

Bex
Bex
Top achievements
Rank 1
 answered on 20 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?