Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
131 views

I have a very strange problem I am using a RadGrid with an .ascx user control form to do editing and adding of new records.  The form works fine when I am editing a record but crashes when I attempt to add a record.

This is the code used to setup the dropdown on the .ascx page

<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="EntityDataSource1"
                        DataTextField="StatusDescription" DataValueField="StatusDescription"
                        SelectedValue='<%# DataBinder.Eval(Container, "DataItem.Status") %>'>
                        <asp:ListItem Selected="True" Text="Select" Value="">
                            </asp:ListItem>
                    </asp:DropDownList>

This is the C# code behind for that page.

namespace CrimeTips
{
    public partial class InvestigationDetailsControl : System.Web.UI.UserControl
    {
        private object _dataItem = null;
 
 
        public object DataItem
        {
            get
            {
                return this._dataItem;
            }
            set
            {
                this._dataItem = value;
            }
 
        }
 
        protected void DropDownList1_SelectedIndexChanged(object sender, DropDownListEventArgs e)
        {
            string StatusValue = DropDownList1.DataValueField;
        }
         
    }
}

And here is the ASPX code for the EditFormSettings

<EditFormSettings UserControlName="InvestigationDetailsControl.ascx" EditFormType="WebUserControl">
                        <EditColumn UniqueName="EditCommandColumn1">
 
                    </EditColumn>
                    </EditFormSettings>

The problem is when I edit the data the form works without any issues.  However, when I attempt to add a records the application crashes with the yellow screen of death with an error message stating

'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value 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.ArgumentOutOfRangeException: 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value

I do not understand why the form works for editing purposes but will not render for the add record can someone offer an explanation and a fix for the problem?

 

Thanks

Perry
Top achievements
Rank 1
 answered on 28 Mar 2016
1 answer
172 views

hi

I would like to hide link when time has passed. How should i go about it? Thanks a lot

<telerik:GridBoundColumn DataField="Time"   FilterControlAltText="Filter Time column" HeaderText="Time" ReadOnly="True" SortExpression="Time" UniqueName="Time">
                    <ColumnValidationSettings>
                    </ColumnValidationSettings>
                </telerik:GridBoundColumn>

   <telerik:GridButtonColumn CommandName="detailcolumn" FilterControlAltText="Filter column column" ItemStyle-ForeColor="#3498DB" ItemStyle-Font-Underline="true"  HeaderText="Detail" Text="Detail" 
                        UniqueName="detailcolumn" >                     
                    </telerik:GridButtonColumn>

 

Kostadin
Telerik team
 answered on 28 Mar 2016
10 answers
3.0K+ views
I've been getting the error below on my production server only ever since I upgraded to the RADControls for ASP.NET Q2 release, file version 2010,2,713,40.  By adding the try/catch below I was able to indetify what assembly was causing the error

 "Could not load file or assembly 'Telerik.Web.UI, Version=2010.1.519.40, Culture=neutral, PublicKeyToken=121fae78165ba3d4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

The problem is this assembly version does not exist on either my dev or production environment.  This happens everytime I make an update to my prod box and I can usually resolve it by resetting the app pool or resetting IIS but it doesn't always work the first time.  All of my projects are set up under the 4.0 framework and I've cleaned the solution several times but the issue persists.  Also, this error only occurs on pages that use the Entity Framwork to databind.  Any help would be greatly appreciated,

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

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.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
  
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: 
  
  
[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0
   System.Reflection.RuntimeModule.GetTypes() +4
   System.Reflection.Assembly.GetTypes() +78
   System.Data.Metadata.Edm.ObjectItemConventionAssemblyLoader.LoadTypesFromAssembly() +32
   System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load() +25
   System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData) +160
   System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, KnownAssembliesSet knownAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage, Object& loaderCookie, Dictionary`2& typesInLoading, List`1& errors) +166
   System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage) +316
   System.Data.Metadata.Edm.ObjectItemCollection.ExplicitLoadFromAssembly(Assembly assembly, EdmItemCollection edmItemCollection, Action`1 logLoadMessage) +53
   System.Data.Metadata.Edm.MetadataWorkspace.ExplicitLoadFromAssembly(Assembly assembly, ObjectItemCollection collection, Action`1 logLoadMessage) +93
   System.Data.Metadata.Edm.MetadataWorkspace.LoadFromAssembly(Assembly assembly, Action`1 logLoadMessage) +130
   System.Web.UI.WebControls.EntityDataSourceView.ConstructContext() +585
   System.Web.UI.WebControls.EntityDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +76
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
   System.Web.UI.Control.EnsureChildControls() +102
   System.Web.UI.Control.PreRenderRecursiveInternal() +42
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
  
  

try
       {       
           RadScheduler1.DataSource = TED.BLL.Appointment.Appointments(SafeValue.SafeInt(ddlView.SelectedValue),SafeValue.SafeInt(ddlCategory.SelectedValue),SafeValue.SafeInt(ddlClientName.SelectedValue),Users,RadScheduler1.VisibleRangeStart, RadScheduler1.VisibleRangeEnd);
           RadScheduler1.DataKeyField = "ID";
           RadScheduler1.DataStartField = "Start";
           RadScheduler1.DataEndField = "End";
           RadScheduler1.DataSubjectField = "Subject";
           RadScheduler1.DataDescriptionField = "Description";
           RadScheduler1.DataRecurrenceParentKeyField = "RecurrenceParentID";
           RadScheduler1.DataRecurrenceField = "RecurrenceRule";
           RadScheduler1.DataBind();
       }
       catch (Exception ex)
       {
           ReflectionTypeLoadException exception = ex as ReflectionTypeLoadException;
           if (exception == null)
           {
               using (TextWriter tw = new StreamWriter(Server.MapPath("~/Scheduler/EDSLog.txt")))
               {
                   tw.WriteLine("Not a ReflectionTypeLoadException ex.");
               }
           }
           else
           {
               foreach (Exception loaderException in exception.LoaderExceptions)
               {
                   using (TextWriter tw = new StreamWriter(Server.MapPath("~/Scheduler/EDSLog.txt")))
                   {
                       tw.WriteLine(loaderException.Message);
                       tw.WriteLine(loaderException.StackTrace);
                   }
               }
           }
       }
Prasad
Top achievements
Rank 1
 answered on 28 Mar 2016
2 answers
185 views

Hi all

 

I will try to explain you my problem (I'm french with bad engl

I have a datepicker wich, when date is selected, update other items (like button text...) So, I use OnSelectedDateChanged="RadDatePicker1_SelectedDateChanged"

 

In the js code I need to do 2 things : 

1 - Check the css class for make an alert or not. Because, I have day-render function wich change css class of cell if the date is on a list like that : 

 protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
        {
            for (int i = 0; i < ListeDate.Count; i++)
            {
                string DateACompare = String.Format("{0:dd/MM/yyyy}", ListeDate[i]);
                DateTime rdvDate = DateTime.ParseExact(DateACompare, "dd/MM/yyyy", null);
                if (e.Day.Date == rdvDate)
                {
                    //e.Cell.BackColor = Color.Red;
                    e.Cell.CssClass = "CasePrise";
                }
            }
        }

 

If css class is not "CasePrise" I want make and alert

 

2 - Refresh my page for update other control with the date selected

 

So I do that, in js :

function RadDatePicker1_OnDateSelected(sender,args)
{
   //Add JavaScript handler code here
   //alert(sender.get_selectedDate());
   __doPostBack('', '');
   if ($(sender).hasClass("CasePrise"))
            alert('Ok');
        else
            alert('Aucunes captures à la date selectionnée')

   
}
function __doPostBack(eventTarget, eventArgument) {
   if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
       theForm.__EVENTTARGET.value = eventTarget;
       theForm.__EVENTARGUMENT.value = eventArgument;
       theForm.submit();
   }
}

 

 

I have two problems : The first is that it don't check the cssclass

The second is that, when it do the postback, my day_render function don't work, so, the cell in my datepicker don't have different background color as it should

 

I hope my message will be understanding

 

Thanks for help

Eyup
Telerik team
 answered on 28 Mar 2016
1 answer
54 views

Hi

Does anyone one why this line is preventing the edit form from displaying when I click "add new record"? The edit form displays normally when I click edit on a row.

<asp:DropDownList ID="lst_ProjectCode" class="form-control" runat="server" Width="250" DataSourceID="SqlDataSource2" DataValueField="ProjectCode" SelectedValue='<%# Bind("ProjectCode")%>'></asp:DropDownList>

It is something to do with the SelectedValue='<%# Bind("ProjectCode")%>' as otherwise it the edit form comes up.

 

 

Kostadin
Telerik team
 answered on 28 Mar 2016
4 answers
133 views

Hi, everyone.

 

I want to use RadHtmlChart -> ' Scatter Chart ' to make "nine grid model" to show my record from DataSource and so... I have make it like '9grid_original.PNG' then I want to display background like '9grid_want.PNG'.

 

Have RadHtmlChart have any method or any styling features to display background like '9grid_want.PNG' (that pic edit with paint)

Or I shoud use Div and any CSS to make it than RadHtmlChart Function?

 

Thanks for every suggestion and Sorry about my weird English.

 

Marin Bratanov
Telerik team
 answered on 28 Mar 2016
1 answer
127 views
Hi,

I'm working with KendoUI on the front end, and following some of their "default" way of doing things (that means using their DataSource object), I request data from a MVC WebAPI controller with a GET.

The request looks like :

filter[logic]                    And
filter[filters][0][field]         Description    
filter[filters][0][operator]    StartWith
filter[filters][0][value]        $20
page                            1
pageSize                        10
skip                            0
take                            10



I had tried so many ways to read the filters but all in vain.

Can anyone help/advice me how to map these query-strings into an object?

Thanks a lot.
Alexander Valchev
Telerik team
 answered on 28 Mar 2016
1 answer
506 views

I am trying to build an offline app with telerik grids. I am using grid with inline editing 

.Editable(editable => editable.Mode(GridEditMode.InLine))

Now i want to check, before of after the save attempt was made (actually it would be a lot better before, but i couldnt manage that with inline editing, so I am waiting for the result from the controller), if there is an internet connection, and if not to save the data in the localstorage and change the color of the row to indicate that this entry has not been saved to the server. I have tried to use the onChange on the datasource and check if the "sync" button is pressed.

.DataSource(dataSource => dataSource
                         .Ajax()
                         .PageSize(10)
                         .Model(model => model.Id(p => p.Nr))
                         .Events(events => events.Change("onChange"))
                         .Create(update => update.Action("Service_Create", "Service"))
                         .Update(update => update.Action("Service_Update", "Service"))
                         .Read(read => read.Action("Service_Read", "Service").Data("ServiceSearchparameter"))
                    )

function onChange(e) {
        if (e.action == 'sync') {
 
            var tr = $(e.target).closest("tr"); //get the row
 
            tr.addClass("offlineElement");
 
                   
        }
   }

 

When I do it like that, nothing is happening, I checked the sourcecode and the class "offlineElement" is not being added to the tr

Is there something I am missing ?

 

P.S Sorry for posting here, since I am using the trial version, I am not allowed to post on ASP.NET MVC forum

Radoslav
Telerik team
 answered on 28 Mar 2016
1 answer
121 views

hello every body , 

i'm using telerik:RadSocialShare in webpage TitleToShare work fine with twitter and linked in , but with facebook it share webpage footer , 

please any advice , here telerik control 

 <telerik:RadSocialShare RenderMode="Lightweight" ID="RadSocialShare3" runat="server"
                                Width="240" >
                                <MainButtons>
                   <telerik:RadSocialButton CustomIconWidth="46" CustomIconHeight="46" CustomIconUrl="images/icons/ico-fb.png"
                                        SocialNetType="ShareOnFacebook"   TitleToShare="شارك معنا وساعدنا في فهم التحديات والفرص الأساسية التي تواجه توظيف الشباب في قطاع تكنولوجيا المعلومات والاتصالات. كيف ترى التحديات والفرص الحالية؟ وكيف تتخيل المستقبل في هذا القطاع؟ اجابتك سوف تساعدنا لاستكشاف مسارات المستقبل المحتملة للشباب في هذا القطاع. مشاركتكم  أساسية لمحاولة الوصول إلى المستقبل الذي نطمح اليه والتحضير للتحديات المصاحبة له."
                                        CssClass="sshCustomCircleFB"></telerik:RadSocialButton>
                                    <telerik:RadSocialButton CustomIconWidth="46" CustomIconHeight="46" CustomIconUrl="images/icons/ico-tw.png"
                                        SocialNetType="ShareOnTwitter" CssClass="sshCustomCircleTwitter"></telerik:RadSocialButton>
                                    <telerik:RadSocialButton CustomIconWidth="46" CustomIconHeight="46" CustomIconUrl="images/icons/ico-li.png"
                                        SocialNetType="LinkedIn" CssClass="sshCustomCircleLinkdedIn"></telerik:RadSocialButton>
                                </MainButtons>
                            </telerik:RadSocialShare>

 

Regards , 

Marin Bratanov
Telerik team
 answered on 28 Mar 2016
3 answers
523 views
I have a column in grid which is of " DateTime " data type. I have default filtering set ON for the grid and the code for the column goes like this :
                    <telerik:GridBoundColumn UniqueName="OrderDate" DataField="OrderDate" HeaderText="Ordered on"
                        CurrentFilterFunction="EqualTo" ShowFilterIcon="False" AutoPostBackOnFilter="True"
                        DataFormatString="{0:MM/dd/yy}" DataType="System.DateTime">
                        <ItemStyle HorizontalAlign="Right" />
                        <HeaderStyle HorizontalAlign="Right" Width="65px" />
                    </telerik:GridBoundColumn>

And the grid is showing all the columns perfectly as expected. For the above code the grid shows only the date in the column but not the time. But, I want to filter the column only by date and not by date time. As when I serach only by date, the filter results with no records for a particular date, as the time(for the provided date) does not match when I do not provide it(I think it takes the default time "00:00:00.000"). I am unable to achieve this. Please help me out.

Thanks.
Kostadin
Telerik team
 answered on 28 Mar 2016
Narrow your results
Selected tags
Tags
+124 more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?