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

Handling events inside Advanced Templates

4 Answers 106 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 27 Aug 2008, 05:33 PM
Hey guys.

I haven't looked into it much, but before I do, I figured I would ask around and see if you have any ideas. 

I'm including other Telerik controls, like a ComboBox and RadGrid inside of the SchedulerDefaultForm of the Advanced Templates and, so far, any event fired from either of these controls gives this error:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
The stack trace is something like this:

"   at System.Web.UI.Page.GetDataItem()\r\n   at ASP.taskbuilder_advancedscheduler_schedulerdefaultform_ascx.__DataBindingradddlGroupName(Object sender, EventArgs e) in c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\Temporary ASP.NET Files\\integrationnode\\5a4379f7\\123b663a\\App_Web_si58sjnd.0.cs:line 0\r\n   at System.Web.UI.Control.OnDataBinding(EventArgs e)\r\n   at Telerik.Web.UI.RadComboBox.OnDataBinding(EventArgs e)\r\n   at Telerik.Web.UI.RadComboBox.PerformSelect()\r\n   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()\r\n   at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound()\r\n   at System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e)\r\n   at Telerik.Web.UI.RadDataBoundControl.OnPreRender(EventArgs e)\r\n   at Telerik.Web.UI.RadComboBox.OnPreRender(EventArgs e)\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Control.PreRenderRecursiveInternal()\r\n   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)" 

The ComboBox is declared thusly:

<telerik:RadComboBox ID="radddlGroupName" runat="server" Skin="Outlook" Style="margin: 0.8em 0pt 0pt 15px;" Width="400px" HighlightTemplatedItems="true" DataSourceID="TaskGroups_DS" DataTextField="Name" DataValueField="GroupId" SelectedValue='<%# Bind("GroupId") %>' OnSelectedIndexChanged="radddlGroupName_SelectedIndexChanged"
            <HeaderTemplate> 
              <table> 
                <tr> 
                  <td width="40" valign="top">Name</td> 
                  <td>Description</td> 
                </tr> 
              </table> 
            </HeaderTemplate> 
            <Items> 
              <telerik:RadComboBoxItem runat="server" Text="[-- Select a Group to Execute With This Item --]" Value="-1" /> 
            </Items> 
            <ItemTemplate> 
              <table style="height: 40px;"
                <tr> 
                  <td style="width: 50px; height: 21px;"
                    <asp:Label ID="lblGroupNameLabel" runat="server" Text='<%# Eval("GroupId") + "-" + Eval("Name") %>'></asp:Label> 
                  </td> 
                  <td style="height: 21px;"
                    <asp:Label ID="lblGroupDescription" runat="server" Text='<%# Eval("Description") %>'></asp:Label> 
                  </td> 
                </tr> 
              </table> 
            </ItemTemplate>          
          <CollapseAnimation Duration="200" Type="OutQuint" /> 
        </telerik:RadComboBox> 

GroupId in the Header is coming from the overall combo data source, and the GroupId to bind the SelectedValue to is a custom attribute.

The only difference in the way I've handled GroupId here vs Description in the Telerik example project is that I do not pass GroupId down through the control chain, with Bindable properties and the like.  Is this the problem?

If not, how do you suggest handling PPP inside the template given the highly volatile binding situation presented with this nested control structure?

Thanks,

Adam.g



4 Answers, 1 is accepted

Sort by
0
Adam
Top achievements
Rank 1
answered on 27 Aug 2008, 07:20 PM

Actually, I've solved this problem.  It looks like the in-line binding of the selected value was bombing.  I have my second problem now, though.

At the moment, I have no Ajaxification from the Scheduler up.  Whenever I attempt to edit the RadGrid in my SchedulerDefaultForm, not only does the Grid not go into edit mode after the postback, but all of the form fields lose their visibility settings, the labels on the page lose their values, Subject and Description, Start Date, End Date all lose what is probably their databindings.

Is there any obvious reason for this?

Thanks,

Adam.g
0
Adam
Top achievements
Rank 1
answered on 28 Aug 2008, 12:58 PM

As another note, it is simple to recreate this problem by adding a RadGrid to the SchedulerDefaultForm in, I'd imagine, any of your Custom Template examples.  As I was debugging the issue, I downloaded your example project using a master page, added a generic RadGrid to the page, and any grid event, like paging, posts the page back and loses the information bound to the controls.  I do notice, however, that the controls in the template are normal html controls, if I'm not mistaken. 

Any ideas?
0
Accepted
Peter
Telerik team
answered on 01 Sep 2008, 03:07 PM
Hello Adam,

I verified that there is a problem related to loss of data for the bound controls for older versions of Telerik.Web.UI. However, I tested with the latest SP1 (version 2008.2.826) and the problem is fixed. Could you please try the latest version yourself and let us know how it goes on your side?

Kind regards,
Peter
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Adam
Top achievements
Rank 1
answered on 12 Nov 2008, 02:46 PM
Thanks, guys.  That cleared it right up.  I actually have another small bug related to the RadScheduler, but I will create a separate post for that.
Tags
Scheduler
Asked by
Adam
Top achievements
Rank 1
Answers by
Adam
Top achievements
Rank 1
Peter
Telerik team
Share this question
or