Depart_Name | Cost |
A | 50 |
B | 25 |
C | -10 |
D | 48 |
E | -63 |
Total | 50 |
Here is a problem I encountered while working with Visual Studio 2005 and 2008....
The last time this happened to me was while working on TFS custom control. So in order to create a custom control, we must add the assembly we have created and a wicc file to the following folder:
"C:\Documents and Settings\All Users\Application Data\Microsoft\Team Foundation\Work Item Tracking\Custom Controls\9.0"
This is the path where TFS (Team Explorer) will look at when using custom controls.
When I deployed a new version of the custom control to that location I suddenly started receiving the InvalidCastException telling me that it was:
"Unable to cast object of type 'x' to object of type 'x'"
So, what happened here? The common sense tells us that this should be a version issue.
What did I find out?
If you attach to a running instance of VS2005/8 and check what Modules are loaded (you may need to add the Modules window command from the Debug category in Tools --> Customize...) you'll probably see two versions of your assembly are loaded, or even the same version of the assembly loaded twice: in both cases you'll see the same error message.
Why does it happen?
The IDE uses cache to store the assemblies for its projects. The IDE caches versions of assemblies in the following folder:
"x\Documents and Settings\user\Local Settings\Application Data\Microsoft\VisualStudio\8.0\ProjectAssemblies"
And at least in my case doesn't detect the particular assembly containing the type has a new version and it doesn't update the cache.
How do I solve it?
So first step, delete all folders in ProjectAssemblies. Next, make sure the IDE can only find ONE copy of your assembly, which is easier if you only have one copy of the DLL in your disk, and only one reference to it (or exactly the same reference from all projects) in your solution
<
telerik:RadComboBox
ID
=
"ddMarketTier"
runat
=
"server"
name
=
"market_tier"
class
=
"property_select"
Filter
=
"Contains"
EmptyMessage
=
"Market Tier"
Width
=
"99%"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"Market Tier"
Value
=
""
/>
<
telerik:RadComboBoxItem
Text
=
"Luxury"
Value
=
"L"
/>
<
telerik:RadComboBoxItem
Text
=
"Upscale"
Value
=
"U"
/>
<
telerik:RadComboBoxItem
Text
=
"Midscale"
Value
=
"M"
/>
<
telerik:RadComboBoxItem
Text
=
"Economy"
Value
=
"E"
/>
</
Items
>
</
telerik:RadComboBox
>
<
CompressorSettings
compressCSS
=
"true"
reflectionAllowed
=
"true"
compressJavaScript
=
"true"
compressPage
=
"false"
compressWebResource
=
"true"
minifyContent
=
"true"
combineCSS
=
"true"
combineHeaderScripts
=
"true"
cachingStorage
=
"OutputCache"
autoMode
=
"false"
scriptsVersion
=
"1"
cssVersion
=
"1"
>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="extrapage.aspx.cs" Inherits="ERM.Sales_Mix.extrapage" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
>Untitled Page</
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
div
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
GridLines
=
"None"
>
<
MasterTableView
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
></
CommandItemSettings
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridTemplateColumn
UniqueName
=
"TemplateColumn"
>
<
ItemTemplate
>
<
table
ID
=
"Table_01"
border
=
"0"
cellpadding
=
"0"
cellspacing
=
"0"
width
=
"400"
>
<
tr
>
<
td
align
=
"center"
background
=
"images/TABLE_01.gif"
colspan
=
"5"
height
=
"29"
>
<
font
color
=
"#FFFFFF"
face
=
"Arial"
size
=
"+1"
>Month Title</
font
></
td
>
</
tr
>
<
tr
>
<
td
background
=
"images/TABLE_02.gif"
height
=
"27"
width
=
"156"
>
</
td
>
<
td
background
=
"images/TABLE_03.gif"
height
=
"27"
width
=
"62"
>
</
td
>
<
td
background
=
"images/TABLE_04.gif"
height
=
"27"
width
=
"60"
>
</
td
>
<
td
background
=
"images/TABLE_05.gif"
height
=
"27"
width
=
"62"
>
</
td
>
<
td
background
=
"images/TABLE_06.gif"
height
=
"27"
width
=
"60"
>
</
td
>
</
tr
>
<
tr
>
<
td
height
=
"19"
width
=
"156"
>
</
td
>
<
td
height
=
"19"
width
=
"62"
>
</
td
>
<
td
height
=
"19"
width
=
"60"
>
</
td
>
<
td
height
=
"19"
width
=
"62"
>
</
td
>
<
td
height
=
"19"
width
=
"60"
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"5"
height
=
"19"
width
=
"60"
>
</
td
>
</
tr
>
</
table
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
</
div
>
</
form
>
</
body
>
</
html
>
protected void rsPeopleScheduler_OnAppointmentClick(object sender, Telerik.Web.UI.SchedulerEventArgs e){
try
{
//Response.Redirect("default.aspx?apptid=" + e.Appointment.ID);
string popupfrm = @"window.showModalDialog('PeopleJobDetails.aspx'
,''
,'dialogWidth:1500px; dialogHeight:700px; center:yes');"
;
RadScriptManager.RegisterClientScriptBlock(this,
this.GetType(),
"OpenPopupPeopleJobDetails",
popupfrm,
true);
}
catch (Exception ex)
{ }
finally { }
}
Its coming out fine but when I try to close the popup window:
RadScriptManager.RegisterClientScriptBlock(this,
this.GetType(),
"Close_Window",
"window.close();",
true);
It goes back radScheduler but with a appointment edit window open on the scheduler.
protected
void
SectionGrid_UpdateCommand(
object
source, GridCommandEventArgs e)
{
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
...
...
protected
void
SectionGrid_InsertCommand(
object
source, GridCommandEventArgs e)
{
UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
...
...