This is a migrated thread and some comments may be shown as answers.

[Solved] Initial page load - no binding wanted

2 Answers 153 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Chris Trina
Top achievements
Rank 1
Chris Trina asked on 04 Jan 2010, 05:28 PM
This should be easy, but I can't find an answer..............

On the initial load of my page I do not want to show the scheduler, nor is there data to bind to it.  Even though the scheduler is set to disabled and not visible I get a runtime error that the bind fields were not all supplied.  Is there any way to not bind the scheduler?  I will want to bind it later, but not yet

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Jan 2010, 07:45 AM
Hi Chris,

One suggestion is setting the DataSourceID and calling the Rebind() method in PageLoad event after checking whether it is postback or not. The DataBound events of RadScheduler will fire only on postback, in this case.

ASPX:
 
<telerik:RadScheduler ID="RadScheduler1" runat="server"  
    DataKeyField="ID" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="RecurrenceParentID" 
    DataStartField="Start" DataSubjectField="Subject" DataEndField="End" 
    OnAppointmentCreated="RadScheduler1_AppointmentCreated" 
    OnAppointmentDataBound="RadScheduler1_AppointmentDataBound"
</telerik:RadScheduler> 

CS:
 
protected void Page_Load(object sender, EventArgs e) 
    { 
        if (!IsPostBack) 
        { 
            RadScheduler1.Enabled = false
            RadScheduler1.Visible = false
        } 
        if (IsPostBack) 
        { 
            RadScheduler1.Enabled = true
            RadScheduler1.Visible = true
           
            RadScheduler1.DataSourceID = "SqlDataSource2"
            RadScheduler1.Rebind(); 
        }        
    } 






Hope this helps,
Shinu.
0
Chris Trina
Top achievements
Rank 1
answered on 05 Jan 2010, 01:12 PM
Thanks for the help.  I was being stupid, all I had to do was specify the the binding fields in the aspx page.  It no longer blows up even though I do not do the actual bind until a later event.  Before I was specifying the fields at the time of the bind so the scheduler was throwing a runtime error in the cases where the bind did not occur.

Thanks for the help.
Tags
Scheduler
Asked by
Chris Trina
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Chris Trina
Top achievements
Rank 1
Share this question
or