Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
69 views
I've been trying to figure out how to delete a radgrid, but it seems the best solution is to set its visibility to false and work off of that.

So i tried that, and now lets say i have 4 grids:

Grid1
Grid2
Grid3
Grid4

And i delete Grid3, and now i am left with:

Grid1
Grid2
Grid4

And i have a button that you can click on, that shows all the grids and the data in the grid, if i don't delete any grids it works fine, but if i delete one of the grids, i get the following error when i click to PreviewAll grids.

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.

Below is the code i am using to "Delete the grid" which is just setting the visibility to false:

public void DeleteGrid(object sender, EventArgs e, PlaceHolder ph)
   {
       LinkButton gridLink = (LinkButton)sender;
       String gridNum = gridLink.ID.ToString().Split('-').Last();
 
       System.Web.UI.Page currentPage;
       currentPage = (System.Web.UI.Page)System.Web.HttpContext.Current.Handler;
 
       RadGrid grid = (RadGrid)currentPage.FindControl("RadGrid" + gridNum);
       Label lbl = (Label)currentPage.FindControl("Break-" + gridNum);
       LinkButton lbd = (LinkButton)currentPage.FindControl("Delete-Grid-" + gridNum);
       LinkButton lb = (LinkButton)currentPage.FindControl("Show-Grid-" + gridNum);
 
       grid.Visible = false;
       lbl.Visible = false;
       lbd.Visible = false;
       lb.Visible = false;
 
       HttpContext.Current.Session.Add(gridNum, null);
 
   }


PreviewAll grids method, which runs and shows all the grids

public void PreviewAll(PlaceHolder ph)
{
 
    ph.Controls.Clear();
 
 
    for (int i = 1; i <= Convert.ToInt32(GetSession()); i++)
    {
        if (HttpContext.Current.Session[i.ToString()] == null)
        {
 
            HttpContext.Current.Response.Write("Session " + i.ToString() + " is null");
        }
        else
        {
            LinkButton btn = new LinkButton();
            btn.ID = "Modal-" + i.ToString();
            btn.Text = "Show Room " + i.ToString();
            btn.Click += (sender, e) => ShowPopUp(sender, e, i, ph);
 
            DataTable table = (DataTable)HttpContext.Current.Session[i]; // Get the data table.
            Label lbl = new Label();
            lbl.ID = "Room-" + i.ToString();
            lbl.Text = "Room " + i.ToString();
 
            Label lblBreak = new Label();
            lblBreak.ID = "Label-Break" + i.ToString();
            lblBreak.Text = "<br/>";
 
 
 
            ph.Controls.Add(lbl);
            ph.Controls.Add(lblBreak);
            ph.Controls.Add(btn);
            ph.Controls.Add(lblBreak);
 
            foreach (DataRow row in table.Rows) // Loop over the rows.
            {
                foreach (var item in row.ItemArray) // Loop over the items.
                {
                    Label lblValue = new Label();
                    lblValue.ID = "Label-Value-" + item.ToString();
                    lblValue.Text = item.ToString();
 
                    Label lblBreak2 = new Label();
                    lblBreak2.ID = "Label-Break" + i.ToString();
                    lblBreak2.Text = "<br/>";
 
                    ph.Controls.Add(lblValue);
                    ph.Controls.Add(lblBreak2);
                }
            }
            
        }
    }
}

Any help is very much appreciated.
Angel Petrov
Telerik team
 answered on 17 Oct 2013
3 answers
73 views
Hi,

I am using two RadGrids on a page, I am able to toggle the arrows when I am working on one grid, but my problem is I want to collapse one grid row when I Expand a row in another Grid.
Please help me.

Thanks,
K. R.Murthii
Top achievements
Rank 1
 answered on 17 Oct 2013
9 answers
157 views
Hi,

I have added a RadScheduler to my page, which loads several calendars from exchange. To realize that I used your Live Demo/Exchange example. Until now, this works fine.

As the calendars I'm reading from are meeting rooms, I would like to view them as resources. In another thread I have read the following: The mailboxes can be mapped to RadScheduler resources in the CreateAppointmentsFromCalendarItem method. You should inspect the mailbox of the calendar item and assign a corresponding resource.

I had a look in the code, but I don't seem to get this working. Does someone have a working example for this? I can't imagine that I'm the only one who wants to realize something like this.

Many thanks in advance!
Boyan Dimitrov
Telerik team
 answered on 17 Oct 2013
2 answers
110 views
Hi,

How can i select an item in javascript?

Thank you,
Sonia.

Sonia
Top achievements
Rank 1
 answered on 17 Oct 2013
1 answer
153 views

Hi,

How to change the forecolor of a row depending on a column value?

Thanks,
Ryann.
Princy
Top achievements
Rank 2
 answered on 17 Oct 2013
1 answer
93 views

Hi,
How to  make Radgrid borders to be rounded?

Thanks,
Dawson.
Princy
Top achievements
Rank 2
 answered on 17 Oct 2013
1 answer
146 views
Hi

I need to hide the progress bars which appear for each images after saving the image to the TemporaryFolder folder. Im hoping do it in the OnClientFilesUploaded event. Can anyone have solution for how to hide the progress bars?

Thanks
Ashan

Shinu
Top achievements
Rank 2
 answered on 17 Oct 2013
12 answers
179 views
Hello,

does anybody has an example how to add an upload image inside a radgrid in edit and insert template and when edited to save the filename in database and image in a specified folder?
I just installed the trial version and I'm beginner in .NET .. sorry if there was an easy way and i didn't found it ,

thank you
Radoslav
Telerik team
 answered on 17 Oct 2013
3 answers
169 views
We are uploading an unusually large file of 2.6gb using RadAsyncUpload but it appears to randomly stop (anywhere between 1 and 5%) with the following Javascript error


Looking further into the error with Firefox shows the following details...

Post: {"TotalChunks":1229,"ChunkIndex":0,"TotalFileSize":2577377324,"UploadID":"1381758285922File.zip"}

Response:

Server Error in '/' Application.
Value was either too large or too small for an Int32.
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.OverflowException: Value was either too large or too small for an Int32.
 
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:
 
 
[OverflowException: Value was either too large or too small for an Int32.]
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +9594371
   System.ComponentModel.Int32Converter.FromString(String value, NumberFormatInfo formatInfo) +53
   System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) +302
 
[Exception: 2577377324 is not a valid value for Int32.]
   System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) +489
   System.ComponentModel.TypeConverter.ConvertFromInvariantString(String text) +43
   System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject) +510
   System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject) +147
   System.Web.Script.Serialization.ObjectConverter.AssignToPropertyOrField(Object propertyValue, Object o, String memberName, JavaScriptSerializer serializer, Boolean throwOnError) +220
   System.Web.Script.Serialization.ObjectConverter.ConvertDictionaryToObject(IDictionary`2 dictionary, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject) +1175
   System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject) +71
   System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject) +147
   System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) +66
   System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(String input) +74
 
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +0
   System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) +72
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +251
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +28
   Telerik.Web.UI.AsyncUpload.SerializationService.Deserialize(String obj, Type type) +237
   Telerik.Web.UI.AsyncUploadHandler.HandleChunkUploadRequest(String serializedMetaData) +31
   Telerik.Web.UI.AsyncUploadHandler.ProcessRequest(HttpContext context) +262
   Telerik.Web.UI.HandlerRouter.ProcessHandler(String handlerKey, HttpContext context) +92
   Telerik.Web.UI.HandlerRouter.ProcessHandler(HttpContext context) +54
   Telerik.Web.UI.WebResource.ProcessRequest(HttpContext context) +39
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

So it looks like due to the file size in KB going over the limit for an Integer, the file is failing. Can anyone point me in the right direction of what to amend?

Many thanks

Shinu
Top achievements
Rank 2
 answered on 17 Oct 2013
22 answers
1.4K+ views
Hi

I have a RadNumbericTextBox in a grid item template, which binds to the data item correctly.

My Question:
How do I set it to display 4 decimal digits but in such a way that:

1) it ALWAYS shows 4 decimal digits 
    so if my value is 5.50 it must show 5.5000

2) it does NOT round off the value
    so for 5.501599 it shows 5.5015

<telerik:RadNumericTextBox ID="radNumForexComp" runat="server" Culture="English (South Africa)" 
    DbValue='<%# Databinder.Eval(Container.DataItem, "Forex Comp") %>' InvalidStyleDuration="100" 
    LabelCssClass="radLabelCss_Web20" Skin="Telerik" Width="80px" style="TEXT-ALIGN: right" Font-Size="8pt">  
    <NumberFormat AllowRounding="False" DecimalDigits="4"/>  
    <FocusedStyle BorderColor="Red" BorderStyle="Double" /> 
    <HoveredStyle BorderColor="Red" BorderStyle="Double" /> 
</telerik:RadNumericTextBox> 



Vasil
Telerik team
 answered on 17 Oct 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?