Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
831 views
I'm getting the following error and I can' track down the reason.  I have a screen where the user selects criteria. I build the query behind the scenes for the onneeddatasource event  when they click search. On initial load I just display a dummy grid. When I click on search the page postback, assembles and runs the query and returns the correct grid as  expected.  If I click on search a second time or peform any type of post back I get the Failed to load viewstate.

Hopefully you can help me solve this mystery.  Thanks

Error:
Server Error in '/AARates' Application.  
--------------------------------------------------------------------------------  
 
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.   
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.Web.HttpException: 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.  
 
Source Error:   
 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.    
 
Stack Trace:   
 
 
[HttpException (0x80004005): 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.]  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +306  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134  
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221  
   System.Web.UI.Page.LoadAllState() +312  
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1661  
 
   
 

Aspx Grid:
            <telerik:RadPane ID="gridPane" runat="server" Height="400px" Scrolling="None" OnClientResized="ClientResized" > 
                <telerik:RadGrid ID="ARGrid1" runat="server" Width="97%" Height="95%" GridLines="None" PageSize="40" 
                     AllowSorting="true" AllowPaging="true" Visible="true" OnNeedDataSource="ARGrid1_NeedDataSource" OnItemCreated="ARGrid1_ItemCreated" 
                     OnItemCommand="ARGrid1_ItemCommand" ShowStatusBar="true" ShowGroupPanel="true" Skin="Outlook">  
                     <MasterTableView AllowFilteringByColumn="true" AllowMultiColumnSorting="true" Width="100%" CommandItemDisplay="Top" AutoGenerateColumns="true">  
                        <HeaderStyle Width="200px" /> 
                        <Columns></Columns>  
                        <CommandItemSettings AddNewRecordText="" ShowExportToPdfButton="true" ShowExportToWordButton="true" ShowExportToExcelButton="true" ShowExportToCsvButton="true" /> 
                     </MasterTableView> 
                     <ClientSettings AllowColumnsReorder="true" AllowDragToGroup="true" ColumnsReorderMethod="Reorder" EnableRowHoverStyle="true">  
                        <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false" FrozenColumnsCount="1" ScrollHeight="100%" /> 
                        <Resizing ClipCellContentOnResize="false" AllowColumnResize="true" /> 
                     </ClientSettings> 
                     <GroupingSettings ShowUnGroupButton="true" /> 
                     <ExportSettings IgnorePaging="true" OpenInNewWindow="true">  
                        <Pdf AllowPrinting="true" /> 
                     </ExportSettings> 
                </telerik:RadGrid> 
            </telerik:RadPane> 

Code Behind:
        protected void btnSearch_Click(object sender, EventArgs e)  
        {  
            bool pageerrors = false;  
 
            //Clear any existing messages  
            PgMessage.ClearMessages();  
 
            //Run validation before running report  
            //Check date rage  
            if (rdpbegin.SelectedDate == null || rdpend.SelectedDate == null)  
            {  
                PgMessage.DisplayMessage(PageMessage.MessageType.Warning, "* Invalid dates. Date range must be input");  
                pageerrors = true;  
            }  
            if (rdpbegin.SelectedDate > rdpend.SelectedDate)  
            {  
                PgMessage.DisplayMessage(PageMessage.MessageType.Warning, "* Date range is not valid");  
                pageerrors = true;  
            }  
 
            //Check List Type  
            if (rcbListType.SelectedIndex == 0)  
            {  
                PgMessage.DisplayMessage(PageMessage.MessageType.Warning, "* List type must be selected");  
                pageerrors = true;  
            }  
 
            //Ensure at least one code is in rlbCodes  
            if (rlbCodes.Items.Count == 0)  
            {  
                PgMessage.DisplayMessage(PageMessage.MessageType.Warning, "* At least one code must be entered");  
                pageerrors = true;  
            }  
 
            //Run report if no page errors  
            if (!pageerrors)   
            {   
                 
                 //ARGrid1.Visible = true;  
                ARGrid1.Rebind();  
 
                lnkbtnSave.Enabled = true;  
                lnkbtnSaveAs.Enabled = true;  
            }  
        }  
 
        private DataSet BuildRptQuery()  
        {  
            bool pullDaily = true;  
            string strquery = string.Empty;  
            DataSet AADataRpt;  
             
 
//            last = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1).AddDays(-1);   
 
            //Get dates  
            if (rdpbegin.SelectedDate != null)  
            {  
                DateTime begindt = new DateTime(rdpbegin.SelectedDate.Value.Year, rdpbegin.SelectedDate.Value.Month, 1);  
 
                if (begindt <= DateTime.Today.AddDays(-90))  
                {  
                    pullDaily = false;  
                    intbegindt = rdpbegin.SelectedDate.Value.Year * 100 + rdpbegin.SelectedDate.Value.Month;  
                    intenddt = rdpend.SelectedDate.Value.Year * 100 + rdpend.SelectedDate.Value.Month;  
                }  
                else  
                {  
                    strbegindt = rdpbegin.SelectedDate.ToString();  
                    strenddt = rdpend.SelectedDate.ToString();  
                }  
 
 
                //Get field name to search code list on  
                UserListType ult = UserListType.getByKey(Convert.ToInt16(rcbListType.SelectedValue));  
 
                switch (ult.Code)  
                {  
                    case "MBUS":  
                        codetype = "MbuCode";  
                        break;  
                    case "BOB":  
                        codetype = "BookOfBusiness";  
                        break;  
                    case "LOB":  
                        codetype = "LineOfBusiness";  
                        break;  
                    case "MBU":  
                        codetype = "MbuCode";  
                        break;  
                    case "CASE":  
                        codetype = "CaseCode";  
                        break;  
                    case "CONTR":  
                        codetype = "ContractCode";  
                        break;  
                }  
 
                codelist = BuildCodeListQuery();  
 
                //Get fields to return from the grid  
                fieldlist = string.Empty;  
                IList<RadListBoxItem> collection = rlbFields.CheckedItems;  
                foreach (RadListBoxItem item in collection)  
                {  
 
 
                    if (!pullDaily)  
                    {  
                        switch (item.Value)  
                        {  
                            case "ProductionDate":  
                                fieldlistfieldlist = fieldlist + "YearMo " + " [" + item.Text + "],";  
                                break;  
 
                            case "AADataAuditID":  
                                fieldlistfieldlist = fieldlist + "0" + " [" + item.Text + "],";  
                                break;  
                            default:  
                                fieldlistfieldlist = fieldlist + item.Value + " [" + item.Text + "],";  
                                break;  
                        }  
 
                    }  
                    else  
                    {  
                        fieldlistfieldlist = fieldlist + item.Value + " [" + item.Text + "],";  
                    }  
                }  
                fieldlistfieldlist = fieldlist.TrimEnd(',');  
 
 
                //Set report query  
                if (pullDaily)  
                {  
                    strquery = "Select " + fieldlist + " from AAData where ProductionDate >= '" + strbegindt + "' AND ";  
                    strquerystrquery = strquery + "ProductionDate <= '" + strenddt + "' AND " + codetype + " IN (" + codelist + ")";  
                    AADataAADataRpt = AAData.getAAReport(strquery);  
                }  
                else  
                {  
                    strquery = "Select " + fieldlist + " from AADataMonthly where YearMo >= " + intbegindt + " AND ";  
                    strquerystrquery = strquery + "YearMo <= " + intenddt + " AND " + codetype + " IN (" + codelist + ")";  
                    AADataRpt = AADataMonthly.getAAReport(strquery);  
                }  
 
                Session["itemsCount"] = AADataRpt.Tables[0].Rows.Count;  // myDataTable.DefaultView.Count;  
            }  
            else  
            {  
                AADataAADataRpt = AAData.getAAReport("Select ProductionDate,CaseCode,ContractCode,MbuCode from AAData where ProductionDate = 01/01/1900");  
            }  
            return AADataRpt;  
 
        }  
 
        protected void ARGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)  
        {  
            ARGrid1.DataSource = BuildRptQuery();   
        } 
Michael
Top achievements
Rank 1
 answered on 26 Mar 2010
6 answers
186 views
One of our key customers is having performance issues with our Scheduler. They mainly manifest themselves by locking up the Scheduler and occasionally crashing the browser that it is open within.

We have investigated this and found that whenever the mouse is moved around within the Scheduler, the memory and CPU resources spike, often to 100%. This is not while dragging or anything. Though we have a lot of custom client code, it looks to be caused by client mouse events that are native to the Scheduler control.

Has anyone else experienced similar issues?
Is it possible to turn off some/all of the Schedulers client events?
Are there any recommended best practices surrounding this?
Kamen Bundev
Telerik team
 answered on 26 Mar 2010
1 answer
99 views

Hi All,

I'd like to conditionally have a couple of images shown along with the subject of an appointment.  To that end I tried putting the following code into the subject from the AppointmentDataBound event. 

            Dim subject As String = e.Appointment.Subject  
            subject += " - " & dataRowView.Item("Title").ToString()  
 
            Dim Status As Integer = 0 
            Status = CInt(dataRowView.Item("Status"))  
            Dim errorImages As String = "" 
            If Status = 1 OrElse Status = 3 Then  
                errorImages = "<img src=""/images/icons/16/not_ok.png"" border=""0"" />" 
            End If  
            If Status = 2 OrElse Status = 3 Then  
                errorImages += "<img src=""/images/icons/16/not_ok_orange.png"" border=""0"" />"  
            End If  
 
            e.Appointment.Subject = errorImages & subject 

When this executes it works but the <img... is rendered as text in the appointment.  Is there a way to use this method to get the images rendered? 

I could use a AppointmentTemplate but given that the Status flag can affect two images I'm not sure how I could do it.  Any pointers?

Regards,

Jon

Jon
Top achievements
Rank 1
 answered on 26 Mar 2010
1 answer
64 views
I'm having a problem in IE 8 with the Width of combo boxes

    <div style="padding:10px;"
        <telerik:RadComboBox Width="250px" Label="Report Options" ID="RadComboBox1" runat="server" OnClientSelectedIndexChanging="LoadLanCodes" OnClientDropDownOpening="ClearBoxes"
            <Items> 
                <telerik:RadComboBoxItem runat="server" Selected="True" value="" Text="Any" /> 
                <telerik:RadComboBoxItem runat="server" Text="Lan Code" Value="lancode" /> 
                <telerik:RadComboBoxItem runat="server" Text="Support Team" Value="supportteam" /> 
            </Items> 
        </telerik:RadComboBox> 
        <telerik:RadComboBox Width="250px" OnClientItemsRequested="ItemsLoaded" ID="RadComboBox2" runat="server" OnClientSelectedIndexChanging="LoadStates"
        </telerik:RadComboBox> 
        <p> 
        </p> 
        <telerik:RadComboBox Label="State" Width="250px" OnClientItemsRequested="ItemsLoaded" ID="RadComboBox3" runat="server" OnClientSelectedIndexChanging="LoadCities"
        </telerik:RadComboBox> 
        <telerik:RadComboBox Label="City"  Width="250px" OnClientItemsRequested="ItemsLoaded" ID="RadComboBox4" runat="server"
        </telerik:RadComboBox> 
    </div> 

As you can see in the attached image FF works but not correctly
Chrome and IE 8 do not witht he combos taking up the available screen size

Wondering if I'm doing it wrong
Kalina
Telerik team
 answered on 26 Mar 2010
1 answer
76 views
Hello,

I would like to know if it's possible to have a new column (on the left) in the month view where it's written the number of the week.

And in this column, have a dropdownlist to switch  ressources for example.

Thank you
Peter
Telerik team
 answered on 26 Mar 2010
3 answers
109 views
I have a webpage encoded in UTF8 and i write greek. When this text is exported to pdf i get '####' instead of 'κατι'.

With english text is fine.
:(


Rumen
Telerik team
 answered on 26 Mar 2010
2 answers
110 views
I have a horizontal splitter with a top pane and a bottom pane.  Normally I can slide the splitBar up and down.  However, if I have a binary component in one of the panes, I cannot slide the splitBar over it.  Please try the simplified sample code below, and please help me find a solution.  I have been trying to figure this one out for some time.

 

 

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
</telerik:RadScriptManager> 
<telerik:RadSplitter ID="splitter1" Orientation="Horizontal" Width="100%" Height="100%" runat="server">  
<telerik:RadPane ID="paneTop" runat="server" Width="100%" Height="300px" ContentUrl="http://www.yahoo.com">  
</telerik:RadPane> 
<telerik:RadSplitBar ID="splitBar1" runat="server" /> 
<telerik:RadPane ID="paneBottom" runat="server" Width="100%" Height="100%" ContentUrl="RadGridExport.pdf">  
</telerik:RadPane> 
</telerik:RadSplitter> 
Cesar
Top achievements
Rank 1
 answered on 26 Mar 2010
1 answer
63 views
Greetings,

I like the scheduler, but we have some specific customizations required.

1)  how to get the left side of the Schedule to be reserved for doctors' hours, e.g. we want the person making appts to visually see that, e.g., Dr. John  has business hours from 3 - 5 pm, for example.  This could look like an appt block, but is not one at all.  And there may be 4 or 5 of these reserved appointment-looking blocks - each in a different color. 

2) Also, how do I populate the header of the Day Schedule (this is on the same level as "all day" header)?  What's the property.

Many thanks,

Randy Smith
Peter
Telerik team
 answered on 26 Mar 2010
1 answer
99 views
Hey Guys,
I am using a Radscheduler control that edits and Inserts using an advanced custom form.

All works great however I would like to make the start and end time visible in the MonthView because we need user to specify time not only date. Currently if i double click a target slot the advanced insert form appear with only start and end date.

Can you please advise.

Best regards,
Maged
Peter
Telerik team
 answered on 26 Mar 2010
6 answers
262 views
Hello guys.

I'm trying to use this example (without image column, very simple), but I'm setting its datasource by a c# method. The grid is binded correctly and the action started by the "add new record" button, showing all fields to insert a new record. However, the edit and delete button gave me this exception:

Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

and the insert button do nothing.

First: How can I to know the name of controls showed in the insert action?
Second: What's the event fired by Edit and the delete button? I tryed to put a breakpoint in the: RadGrid1_UpdateCommand, RadGrid1_EditCommand, RadGrid1_ItemDeleted, RadGrid1_DeleteCommand, but the system doesn't break at breakpoint.

Tx in advance.

Regards.




Silvio Silva Junior
Top achievements
Rank 2
 answered on 26 Mar 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?