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
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>
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);
}
}
}
}
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
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.
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.
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
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 ,