Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
265 views
I am using RadScheduler for showing/creating the Appointments in my Database.
My code is working fine (Create, Retrieve, Update, Delete) as long as I have non-recurring Appointments. But, as soon as a recurring type Appointment comes in account, everything stops working and I get following error on postback:
Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

What am I doing wrong here? 
Following is my code, On .ASPX page:
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadScheduler ID="RadScheduler1" runat="server" TimeZoneOffset="00:00:00" AdvancedForm-EnableCustomAttributeEditing="true"
        SelectedView="MonthView" OverflowBehavior="Expand" StartInsertingInAdvancedForm="true" EnableViewState="true"
        DataKeyField="AppointmentID" DataStartField="CalendarStartDateTime" DataEndField="CalendarEndDateTime"
        DataSubjectField="AppointmentBody" DataRecurrenceField="RecurrenceRule" DataRecurrenceParentKeyField="ParentAppointmentID"
        DataReminderField="Reminder" OnAppointmentCreated="RadScheduler1_AppointmentCreated" OnAppointmentInsert="RadScheduler1_AppointmentInsert"
        OnAppointmentUpdate="RadScheduler1_AppointmentUpdate" OnAppointmentDelete="RadScheduler1_AppointmentDelete"
        OnRecurrenceExceptionCreated="RadScheduler1_RecurrenceExceptionCreated" OnReminderDismiss="RadScheduler1_ReminderDismiss"
        OnReminderSnooze="RadScheduler1_ReminderSnooze">
        <AdvancedForm Modal="true"></AdvancedForm>
        <Reminders Enabled="true" MaxAge="5"></Reminders>
        <TimeSlotContextMenuSettings EnableDefault="true"></TimeSlotContextMenuSettings>
        <AppointmentContextMenuSettings EnableDefault="true"></AppointmentContextMenuSettings>
    </telerik:RadScheduler>
</asp:Content>


And Code on .CS page:
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        BindAppointments();
    }
}
 
private void BindAppointments()
{
    try
    {
        List<AppointmentEN> lstAppointment = AppointmentProvider.GetAppointments();
 
        foreach (var item in lstAppointment)
        {
            item.RecurrenceRule = string.IsNullOrWhiteSpace(item.RecurrenceRule) ? null : item.RecurrenceRule;
            item.ParentAppointmentID = item.ParentAppointmentID == 0 ? null : item.ParentAppointmentID;
        }
        RadScheduler1.DataSource = lstAppointment;
        RadScheduler1.DataBind();
 
        RadScheduler1.SelectedView = SchedulerViewType.MonthView;
        RadScheduler1.SelectedDate = DateTime.Now;
        //RadScheduler1.Visible = true;
    }
    catch (Exception ex)
    {
    }
}


I have found that doing EnableViewState="false" does the job, but I don't want to do that because then other functionalities like Rescource editing stops working correctly.
Plamen
Telerik team
 answered on 07 May 2014
1 answer
82 views
Hello together,

as this is my first post on this forums and am new to telerik components, please be gentle, if this is a dumb question. ;-)

I try to use two RadGrids which are linked together:

<telerik:RadGrid ID="rgCompanies" runat="server"
        AllowPaging="True" AllowAutomaticUpdates="False" AllowAutomaticInserts="False"
        AllowAutomaticDeletes="False" AllowSorting="true"
        DataSourceID="Companies">
        <MasterTableView AutoGenerateColumns="False"
            DataKeyNames="CompanyId">
            <Columns>
                <telerik:GridBoundColumn DataField="CompanyId" HeaderText="Nr." SortExpression="CompanyId"
                    UniqueName="CompanyId" Visible="true" ReadOnly="true" MaxLength="5">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CompanyName" HeaderText="Unternehmensname" SortExpression="CompanyName"
                    UniqueName="CompanyName" Visible="true" ItemStyle-Width="150" DataFormatString="{0}" ReadOnly="true">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
            <Selecting AllowRowSelect="true"></Selecting>
        </ClientSettings>
    </telerik:RadGrid>

and

<telerik:RadGrid ID="rgProducts" runat="server" AllowPaging="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
        AllowAutomaticDeletes="True" AllowSorting="true"
        DataSourceID="Products">
        <MasterTableView AutoGenerateColumns="False"
            DataKeyNames="ProductId" CommandItemDisplay="Top" >
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" ShowSortIcon="false">
                    <HeaderStyle ForeColor="DimGray" Width="20px" />
                    <ItemStyle HorizontalAlign="Center" />
 
                </telerik:GridEditCommandColumn>
 
                <telerik:GridButtonColumn ConfirmText="Dieses Produkt wirklich löschen?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Löschen" ButtonType="ImageButton" CommandName="Delete" />
 
                <telerik:GridBoundColumn DataField="ProductId" HeaderText="Nr." SortExpression="ProductId"
                    UniqueName="ProductId" Visible="true" ReadOnly="true" MaxLength="5">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Grammage" HeaderText="Grammatur" SortExpression="Grammage"
                    UniqueName="Grammage1" Visible="true" ReadOnly="false" DataFormatString="{0} g/m²">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Width" HeaderText="Breite" SortExpression="Width"
                    UniqueName="Width" Visible="true" ReadOnly="false" DataFormatString="{0} cm">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Height" HeaderText="Höhe" SortExpression=".Height"
                    UniqueName="Height" Visible="true" ReadOnly="true" DataFormatString="{0} cm">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="NumberOfPages" HeaderText="Umfang" SortExpression="NumberOfPages"
                    UniqueName="NumberOfPages" Visible="true" ReadOnly="true" DataFormatString="{0} Seiten">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="PrintType1.PrintTypeName" HeaderText="Drucktyp" SortExpression="PrintType1.PrintTypeName"
                    UniqueName="PrintType1.PrintTypeName" Visible="true" ReadOnly="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Refinement1.RefinementName" HeaderText="Veredelung" SortExpression="Refinement1.RefinementName"
                    UniqueName="Refinement1.RefinementName" Visible="true" ReadOnly="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="PaperType1.PaperTypeName" HeaderText="Papersorte" SortExpression="PaperType1.PaperTypeName"
                    UniqueName="PaperType1.PaperTypeName" Visible="true" ReadOnly="true">
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings EditFormType="Template">
                <FormTemplate>
 
                    <asp:TextBox ID="tbGrammage" runat="server" Text='<%# Bind("Grammage") %>'>
                    </asp:TextBox>
 
                    <asp:TextBox ID="tbWidth" runat="server" Text='<%# Bind("Width") %>'>
                    </asp:TextBox>
 
                    <asp:TextBox ID="tbHeight" runat="server" Text='<%# Bind("Height") %>'>
                    </asp:TextBox>
 
                    <asp:TextBox ID="tbNumberOfPages" runat="server" Text='<%# Bind("NumberOfPages") %>'>
                    </asp:TextBox>
 
                    <asp:DropDownList ID="ddlPrintType" runat="server" SelectedValue='<%# Bind("PrintType") %>' AppendDataBoundItems="true"
                        DataSourceID="PrintTypes" DataValueField="PrintTypeId" DataTextField="PrintTypeName">
                    </asp:DropDownList>
 
                    <asp:DropDownList ID="ddlPaperType" runat="server" SelectedValue='<%# Bind("PaperType") %>' AppendDataBoundItems="true"
                        DataSourceID="PaperTypes" DataValueField="PaperTypeId" DataTextField="PaperTypeName">
                    </asp:DropDownList>
 
                    <asp:DropDownList ID="ddlRefinement" runat="server" SelectedValue='<%# Bind("Refinement") %>' AppendDataBoundItems="true"
                        DataSourceID="Refinements" DataValueField="RefinementId" DataTextField="RefinementName">
                    </asp:DropDownList>
 
 
                    <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button
 
                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                        CommandName="Cancel"></asp:Button>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
        <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
            <Selecting AllowRowSelect="true"></Selecting>
        </ClientSettings>
 
 
 
 
    </telerik:RadGrid>

and the DataSources:

<asp:EntityDataSource ID="Companies" runat="server"
        ConnectionString="name=PortalEntities"
        DefaultContainerName="PortalEntities" EnableFlattening="False"
        EntitySetName="Companies" EntityTypeFilter="Company" EnableInsert="False" EnableDelete="False" EnableUpdate="False">
    </asp:EntityDataSource>
 
    <asp:EntityDataSource ID="Refinements" runat="server"
        ConnectionString="name=PortalEntities"
        DefaultContainerName="PortalEntities" EnableFlattening="False"
        EntitySetName="Refinements" EntityTypeFilter="Refinement" EnableInsert="False" EnableDelete="False" EnableUpdate="False">
    </asp:EntityDataSource>
 
    <asp:EntityDataSource ID="PaperTypes" runat="server"
        ConnectionString="name=PortalEntities"
        DefaultContainerName="PortalEntities" EnableFlattening="False"
        EntitySetName="PaperTypes" EntityTypeFilter="PaperType" EnableInsert="False" EnableDelete="False" EnableUpdate="False">
    </asp:EntityDataSource>
 
    <asp:EntityDataSource ID="PrintTypes" runat="server"
        ConnectionString="name=PortalEntities"
        DefaultContainerName="PortalEntities" EnableFlattening="False"
        EntitySetName="PrintTypes" EntityTypeFilter="PrintType" EnableInsert="False" EnableDelete="False" EnableUpdate="False">
    </asp:EntityDataSource>
 
    <asp:EntityDataSource ID="Products" runat="server"
        ConnectionString="name=PortalEntities"
        DefaultContainerName="PortalEntities"
        EnableFlattening="false"
        EntitySetName="Products" EntityTypeFilter="Product" EnableInsert="true" EnableDelete="true" EnableUpdate="true"
        Where="it.CompanyId = @CompanyId" Include="PrintType1, Refinement1, PaperType1">
        <WhereParameters>
            <asp:ControlParameter ControlID="rgCompanies" DefaultValue="1" Name="CompanyId" PropertyName="SelectedValue" Type="int64" />
        </WhereParameters>
    </asp:EntityDataSource>

But now I have a problem. When I try to add a new product in the second grid, it doesn't get the correct value for the value "CompanyId" in "Products". But it is needed, as it is a foreign key.

I'm quite stuck with this and I'm sure, the solution is quite simple. But nothing I tried yet, worked in any way.

So I would appreciate, if someone can help me out with this.

Yours

Aljoscha
Antonio Stoilkov
Telerik team
 answered on 07 May 2014
1 answer
196 views
Hello!

We bought Telerik tools but still the next message in our proyect:

Thank you for using the Trial Version of Telerik UI for ASP.NET AJAX to build more powerful applications faster. Purchase the Commercial Version now to get access to all product updates and the Telerik expert support. 

What can we do to fix it?

Thank you.
Danail Vasilev
Telerik team
 answered on 07 May 2014
26 answers
887 views
We use RadTextBoxes in a form with a countdown timer for testing purposes.  After so much time elapses, if the user has not submitted the form, it is automatically submitted for him.

This form worked great until 1 or 2 updates ago when the RadTextBox started returning an empty value to the server on occasion.  Since the issue was sporadic we checked many other things before we finally realized it only happened when the form auto submitted.  Then we figured out it was a blur issue with RadTextBox.

In the meantime, this has caused us major problems as examinees type in an essay for 15 minutes and then it is all gone because they were not lucky enough to click outside the RadTextBox.

Now that we know what the problem is, we can work around it with a box.blur() or box.set_value(box.get_textBoxValue()) before postback.

I love these controls but this behavior is a serious breaking change and makes no sense.  There should be no requirement to blur a RadTextBox to get its value to the server.

Please fix this.

Thank you.
Vasil
Telerik team
 answered on 07 May 2014
2 answers
151 views
which control should i use instead  of expander (WPF control) in UI for asp.net ajax. which have the same functionality as an expander.

Konstantin Dikov
Telerik team
 answered on 07 May 2014
6 answers
308 views
I suggest you to review your online demo in "Time picker/DateTime picker" section and add more demo/info re. RadDateTimePicker. Specifically, I would suggest:
  • Add "DateTimePicker - First Look"
  • MOST IMPORTANT: Add DateTimePicker range validation as it's different from TimePicker!            
Konstantin Dikov
Telerik team
 answered on 07 May 2014
2 answers
136 views
I have a RagGrid. On click of "Add New", I want a customized form. Is this possible?
I tried the following but did not work!
protected void _RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
       {
          if (e.CommandName == RadGrid.InitInsertCommandName)
          {
              e.Canceled = true;
              this._RadGrid1.EditIndexes.Clear();

              e.Item.OwnerTableView.EditFormSettings.UserControlName = "AddControl.ascx";
              e.Item.OwnerTableView.InsertItem();
          }          
      }
Princy
Top achievements
Rank 2
 answered on 07 May 2014
3 answers
464 views
I'm doing some work in a javascript function and part of it is to remove (or add) an attribute from a RadTextBox.  Looking at the list of properties and methods on the Client Object page, I don't see how to do this.  I've seen forum posts reference the _textboxelement property of RadTextBox control like so:

<script type="text/javascript"
    function setToolTip() { 
        var RadTextBox = $find("<%= RadTextBox1.ClientID %>");  // Get the textbox client object 
        RadTextBox._textBoxElement.title = "Changed Tooltip"
    
</script>

I was wondering if this would work.  If so, how?

I'm trying to add or remove the data-bind attribute on a textbox.

Thanks.
Shinu
Top achievements
Rank 2
 answered on 07 May 2014
1 answer
604 views
What is the performance difference between a bound column and template column with a label in the template?
Princy
Top achievements
Rank 2
 answered on 07 May 2014
8 answers
662 views
Hi,
I have an application with some telerik:RadComboBox and asp:RequiredFieldValidator to validate empty value.  But it's not working and it's not validating.  I checked the radscript manager and I have an error (Error Creating Control).

I had the application with NET Framework 2.0 and I changed to NET Framework 3.5.  I have instaled Telerik ASP NET Q1 2010

Is it compatible that version of telerik with .NET framework 3.5?
What does the problem with combobox validation?

this si my html:

<telerik:RadComboBox ID="lstCountry" runat="server" AutoPostBack="True"
onselectedindexchanged="lstCountry_SelectedIndexChanged" SkinID="DropDownList" 
TabIndex="17" Width="240px"  >
</telerik:RadComboBox>
<asp:RequiredFieldValidator ID="rfvCountry" runat="server" 
   ControlToValidate="lstCountry" ErrorMessage="Country is required" InitialValue=""
SkinID="RequiredFieldValidator" ValidationGroup="vgpSave"  Text="*">
</asp:RequiredFieldValidator>

Regards

Jose
Shinu
Top achievements
Rank 2
 answered on 07 May 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?