| <asp:ScriptManager ID="scmEvents" runat="server" OnAsyncPostBackError="scmEvents_AsyncPostBackError" /> | |
| <telerik:RadAjaxManager ID="ramEvents" runat="server"> | |
| <AjaxSettings> | |
| <telerik:AjaxSetting AjaxControlID="rscEvents"> | |
| <UpdatedControls> | |
| <telerik:AjaxUpdatedControl ControlID="rscEvents" LoadingPanelID="ralEvents" /> | |
| </UpdatedControls> | |
| </telerik:AjaxSetting> | |
| </AjaxSettings> | |
| </telerik:RadAjaxManager> | |
| <telerik:RadAjaxLoadingPanel ID="ralEvents" runat="server" Transparency="10" BackColor="#E0E0E0" InitialDelayTime="500"> | |
| <asp:Image ID="imgLoading" runat="server" style="margin-top: 200px;" ImageUrl="" BorderWidth="0px" AlternateText="Loading..." /> | |
| </telerik:RadAjaxLoadingPanel> | |
| <telerik:RadScheduler ID="rscEvents" runat="server" Width="750px" Height="561px" style="margin: 0 auto;" Skin="Office2007" SelectedView="MonthView" ShowViewTabs="False" | |
| OnAppointmentInsert="rscEvents_AppointmentInsert" OnAppointmentUpdate="rscEvents_AppointmentUpdate" OnAppointmentDelete="rscEvents_AppointmentDelete" OnAppointmentDataBound="rscEvents_AppointmentDataBound" | |
| DataKeyField="EventId" DataSubjectField="EventName" DataStartField="StartDate" DataEndField="EndDate" DataRecurrenceField="RecurrenceRule" | |
| DataRecurrenceParentKeyField="RecurrenceParentId" StartInsertingInAdvancedForm="True" StartEditingInAdvancedForm="True" DisplayRecurrenceActionDialogOnMove="True" EnableResourceEditing="False"> | |
| <TimelineView UserSelectable="False" /> | |
| </telerik:RadScheduler> |
| /// <summary> | |
| /// I'm using a form of the MVP pattern which is why all of the event handlers look the way they do. | |
| /// </summary> | |
| public partial class Events : BasePage, IEventsView | |
| { | |
| #region Fields | |
| private EventsPresenter presenter; | |
| private int eventId = -1; | |
| private string eventName = String.Empty; | |
| private string eventDescription = String.Empty; | |
| private DateTime startDate = DateTime.MinValue; | |
| private DateTime endDate = DateTime.MinValue; | |
| private string recurrenceRule = String.Empty; | |
| private string recurrenceParentId = String.Empty; | |
| #endregion | |
| #region Constructor | |
| /// <summary> | |
| /// Initializes a new instance of the <see cref="Events"/> class. | |
| /// </summary> | |
| public Events() | |
| { | |
| presenter = new EventsPresenter( this, new EventsDataService(), DefaultInjection.GetDefault() ); | |
| presenter.Init(); | |
| } | |
| #endregion | |
| #region Events | |
| /// <summary> | |
| /// Occurs when the form is loaded | |
| /// </summary> | |
| public event EventHandler FormLoad; | |
| /// <summary> | |
| /// Occurs when an appointment is inserted. | |
| /// </summary> | |
| public event EventHandler AppointmentInsert; | |
| /// <summary> | |
| /// Occurs when an appointment is updated. | |
| /// </summary> | |
| public event EventHandler AppointmentUpdate; | |
| /// <summary> | |
| /// Occurs when an appointment is deleted. | |
| /// </summary> | |
| public event EventHandler AppointmentDelete; | |
| #endregion | |
| #region Event Handlers | |
| protected void Page_Load( object sender, EventArgs e ) | |
| { | |
| if ( !IsPostBack ) | |
| { | |
| if ( FormLoad != null ) | |
| { | |
| FormLoad( sender, e ); | |
| } | |
| } | |
| } | |
| protected void rscEvents_AppointmentInsert( object sender, SchedulerCancelEventArgs e ) | |
| { | |
| SetAppointmentDetails( e.Appointment ); | |
| if ( AppointmentInsert != null ) | |
| { | |
| AppointmentInsert( sender, e ); | |
| } | |
| } | |
| protected void rscEvents_AppointmentUpdate( object sender, AppointmentUpdateEventArgs e ) | |
| { | |
| SetAppointmentDetails( e.ModifiedAppointment ); | |
| if ( AppointmentUpdate != null ) | |
| { | |
| AppointmentUpdate( sender, e ); | |
| } | |
| } | |
| /// <summary> | |
| /// The startDate is used to calculate the beginning date of the schedule | |
| /// </summary> | |
| protected void rscEvents_AppointmentDelete( object sender, SchedulerCancelEventArgs e ) | |
| { | |
| eventId = Int32.Parse( e.Appointment.ID.ToString() ); | |
| startDate = e.Appointment.Start; | |
| if ( AppointmentDelete != null ) | |
| { | |
| AppointmentDelete( sender, e ); | |
| } | |
| } | |
| protected void rscEvents_AppointmentDataBound( object sender, SchedulerEventArgs e ) | |
| { | |
| e.Appointment.ToolTip = e.Appointment.Subject; | |
| } | |
| /// <summary> | |
| /// Captures assynchronous exceptions and handles them in the same way as normal exceptions. | |
| /// </summary> | |
| protected void scmEvents_AsyncPostBackError( object sender, AsyncPostBackErrorEventArgs e ) | |
| { | |
| throw e.Exception; | |
| } | |
| #endregion | |
| #region Properties | |
| /// <summary> | |
| /// This property is set by the Presenter when binding the scheduler control. | |
| /// </summary> | |
| public List<EventDTO> CurrentEvents | |
| { | |
| set | |
| { | |
| List<AppointmentDTO> appointments = new List<AppointmentDTO>(); | |
| foreach ( EventDTO evnt in value ) | |
| { | |
| appointments.Add( new AppointmentDTO( evnt ) ); | |
| } | |
| rscEvents.DataSource = appointments; | |
| rscEvents.DataBind(); | |
| } | |
| } | |
| public int EventId | |
| { | |
| get { return eventId; } | |
| } | |
| public string EventName | |
| { | |
| get { return eventName; } | |
| } | |
| public string EventDescription | |
| { | |
| get { return eventDescription; } | |
| } | |
| public DateTime StartDate | |
| { | |
| get { return startDate; } | |
| } | |
| public DateTime EndDate | |
| { | |
| get { return endDate; } | |
| } | |
| public string RecurrenceRule | |
| { | |
| get { return recurrenceRule; } | |
| } | |
| public string ReccurenceParentId | |
| { | |
| get { return recurrenceParentId; } | |
| } | |
| #endregion | |
| /// <summary> | |
| /// The fields being set in this method are used by the Presenter when saving appointments to the database. | |
| /// </summary> | |
| private void SetAppointmentDetails( Appointment appointment ) | |
| { | |
| eventId = appointment.ID != null ? Int32.Parse( appointment.ID.ToString() ) : -1; | |
| eventName = appointment.Subject; | |
| startDate = appointment.Start; | |
| endDate = appointment.End; | |
| recurrenceRule = appointment.RecurrenceRule; | |
| if ( appointment.RecurrenceParentID != null && !String.IsNullOrEmpty( appointment.RecurrenceParentID.ToString() ) ) | |
| { | |
| recurrenceParentId = appointment.RecurrenceParentID.ToString(); | |
| } | |
| } | |
| #region Classes | |
| /// <summary> | |
| /// Extends the base EventDTO to accomodate functionality in the Telerik Scheduler control by incorporating the RecurrenceState property and | |
| /// making RecurrenceRule and RecurrenceParentId nullable. | |
| /// </summary> | |
| private class AppointmentDTO : EventDTO | |
| { | |
| #region Fields | |
| private RecurrenceState recurrenceState; | |
| #endregion | |
| #region Constructors | |
| private AppointmentDTO() | |
| { | |
| eventId = -1; | |
| } | |
| public AppointmentDTO( int eventId, string eventName, string eventDescription, DateTime startDate, DateTime endDate, string recurrenceRule, string recurrenceParentId ) : this() | |
| { | |
| this.eventId = eventId; | |
| this.eventName = eventName; | |
| this.eventDescription = eventDescription; | |
| this.startDate = startDate; | |
| this.endDate = endDate; | |
| this.recurrenceRule = String.IsNullOrEmpty( recurrenceRule ) ? null : recurrenceRule; | |
| this.recurrenceParentId = String.IsNullOrEmpty( recurrenceParentId ) ? null : recurrenceParentId; | |
| if ( recurrenceParentId != null ) | |
| { | |
| recurrenceState = RecurrenceState.Exception; | |
| } | |
| else if ( !String.IsNullOrEmpty( recurrenceRule ) ) | |
| { | |
| recurrenceState = RecurrenceState.Occurence; | |
| } | |
| } | |
| public AppointmentDTO( EventDTO evnt ) : this( evnt.EventId, evnt.EventName, evnt.EventDescription, evnt.StartDate, evnt.EndDate, evnt.RecurrenceRule, evnt.RecurrenceParentId ) { } | |
| #endregion | |
| #region Properties | |
| /// <summary> | |
| /// This is being setup as per the Binding Generic List demo but it never gets consumed - something I'm missing here??? | |
| /// </summary> | |
| public RecurrenceState RecurrenceState | |
| { | |
| get { return recurrenceState; } | |
| set { recurrenceState = value; } | |
| } | |
| #endregion | |
| } | |
| #endregion | |
| } |
OrderID,ProductID" in the original data source.AppUser.cs:The AppUser.GetAll() method returns an IList<IAppUser> object.
class AppUser : IAppUser
{
public string Account { get; set; }
public string Password { get; set; }
}
Person.cs
class Person: IPerson
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
IAppUser.cs
public interface IAppUser : IPerson
{
string Account { get; set; }
string Password { get; set; }
}
IPerson.cs
public interface IPerson
{
string FirstName { get; set; }
string LastName { get; set; }
}
grid.aspx:
<asp:ScriptManager ID="scriptManager" runat="server"></asp:ScriptManager>
<telerik:RadGrid ID="dgAppuser" runat="server" AutoGenerateColumns="false" AllowSorting="true">
<MasterTableView AllowNaturalSort="false">
<Columns>
<telerik:GridBoundColumn HeaderText="Account" DataField="Account"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Password" DataField="Password"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="First Name" DataField="FirstName"></telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Last Name" DataField="LastName"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
grid.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
dgAppuser.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(dgAppuser_NeedDataSource);
}void dgAppuser_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
dgAppuser.DataSource = AppUser.GetAll();
}
IndexOutOfRangeException: Column LastName was not found.
If the GetAll() method returns IList<AppUser> instead of IList<IAppUser> the sorting is works.
Is there a solution for this problem or must I add all properties from the base interface also to the derived interface?ScriptLoadFailedException. The script /Telerik.Web.Ui.WebResource.axd..........
Missing call to Sys.Application.notifyScriptLoaded.
The error is only happening for specific users on our network in IE6. On one machine the app works fine logged in as me but when logged in as someone with less permissions on the same machine we recieve the above message.
From my understanding it comes from either invalid JS or missing the below.
if( Sys && Sys.Application ){
Sys.Application.notifyScriptLoaded();
}
But..........
Why would this message be privelage specific?????? If it works for one user it should work for them both.
Has anybody experienced this before.
Thanks for any help.

public class RefreshAction
{
// ***********************************************************
// Constants
public const string LastRefreshTicketEntry = "__LASTREFRESHTICKET";
public const string CurrentRefreshTicketEntry = "__CURRENTREFRESHTICKET";
public const string PageRefreshEntry = "IsPageRefresh";
// ***********************************************************
// ***********************************************************
// Manage to check if the F5 button has been pressed
public static void Check(HttpContext ctx)
{
// Initialize the ticket slot
EnsureRefreshTicket(ctx);
// Read the last ticket served in the session (from Session)
int lastTicket = GetLastRefreshTicket(ctx);
// Read the ticket of the current request (from a hidden field)
int thisTicket = GetCurrentRefreshTicket(ctx);
// Compare tickets
if (thisTicket > lastTicket ||
(thisTicket == lastTicket && thisTicket == 0))
{
UpdateLastRefreshTicket(ctx, thisTicket);
ctx.Items[PageRefreshEntry] =
false;
}
else
{
ctx.Items[PageRefreshEntry] =
true;
}
}
// ***********************************************************
// ***********************************************************
// Ensure that the slot for the last ticket served isn't null
private static void EnsureRefreshTicket(HttpContext ctx)
{
// Initialize the session slots for the page (Ticket) and the module (LastTicketServed)
if (ctx.Session[LastRefreshTicketEntry] == null)
ctx.Session[LastRefreshTicketEntry] = 0;
}
// ***********************************************************
// ***********************************************************
// Return the ticket of the last request in the session
private static int GetLastRefreshTicket(HttpContext ctx)
{
// Extract and return the last ticket
return Convert.ToInt32(ctx.Session[LastRefreshTicketEntry]);
}
// ***********************************************************
// ***********************************************************
// Return the ticket of the last request in the session
private static int GetCurrentRefreshTicket(HttpContext ctx)
{
return Convert.ToInt32(ctx.Request[CurrentRefreshTicketEntry]);
}
// ***********************************************************
// ***********************************************************
// Return the ticket of the last request in the session
private static void UpdateLastRefreshTicket(HttpContext ctx, int ticket)
{
ctx.Session[LastRefreshTicketEntry] = ticket;
}
// ***********************************************************
}
public class RefreshModule : IHttpModule
{
// ***********************************************************
// IHttpModule::Init
public void Init(HttpApplication app)
{
// Register for pipeline events
app.AcquireRequestState +=
new EventHandler(this.OnAcquireRequestState);
}
// ***********************************************************
// ***********************************************************
// IHttpModule::Dispose
public void Dispose()
{
}
// ***********************************************************
// ***********************************************************
// Determine if a F5 or back/fwd action is in course
private void OnAcquireRequestState(object sender, EventArgs e)
{
// Get access to the HTTP context
HttpApplication app = (HttpApplication)sender;
HttpContext ctx = app.Context;
// Check F5 action
RefreshAction.Check(ctx);
return;
}
// ***********************************************************
}
This is then used by a custom Page class that my app inherits from that allows me to check if this is a page refresh or not. The relevant methods from my Page class are below:
// **************************************************************
// Indicates if the page is being viewed in response to F5 hit
public bool IsPageRefresh
{
get
{
object o = HttpContext.Current.Items[RefreshAction.PageRefreshEntry];
if (o == null)
return false;
return (bool)o;
}
}
// **************************************************************
// **************************************************************
// Increase the internal counter used to generate refresh tickets
public void TrackRefreshState()
{
InitRefreshState();
int ticket = Convert.ToInt32(Session[RefreshTicketCounter]) + 1;
Session[RefreshTicketCounter] = ticket;
}
// **************************************************************
#region
Private Members
// **************************************************************
// Create the hidden field to store the current request ticket
private void SaveRefreshState()
{
int ticket = Convert.ToInt32(Session[RefreshTicketCounter]) + 1;
RegisterHiddenField(
RefreshAction.CurrentRefreshTicketEntry, ticket.ToString());
}
// **************************************************************
// **************************************************************
// Ensure that the ticket counter is initialized
private void InitRefreshState()
{
if (Session[RefreshTicketCounter] == null)
Session[RefreshTicketCounter] = 0;
}
// **************************************************************
// **************************************************************
// Handle the PreRender event
private void RefreshPage_PreRender(object sender, EventArgs e)
{
SaveRefreshState();
}
// **************************************************************
If there is anything obvious in the above that would interfere with RadAjax, could you suggest how to avoid breaking it? I do understand that I may be able to resolve the problem by having the application(s) reference the scripts and set UseEmbedded Scripts="False", but these HttpModule and Page classes are actually being used as our base classes on several applications. It becomes somewhat less than ideal from a software release distribution standpoint if we have to modify our page markup to reference the right version path of the RadControls for several applications every time we upgrade to a new release of RadControls. It also tends to make the applications know more about the underlying controls than I would prefer, since normally it wouldn;t be typical to have to add the script references on the pages using them.
Thanks,
-Ed