473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Object casting

I'm trying to cast my object in vsnet 2005. Help!

protected void gvEventsEdit_RowDataBound(object sender, GridViewRowEventArgs
e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{

GCS.Business.Event.Event mEvent = ((GCS.Business.Event.Event)e.Row.DataItem);
int ownerGuid = mEvent.EventOwnerGuid;

}
}

any ideas?
May 23 '06 #1
2 1448
Are you getting an error? In what way is it not working as desired?

May 23 '06 #2
Chris,

I get:

Unable to cast object of type 'GCS.Business.Event.EventInfo' to type
'GCS.Business.Event.Event'.

Ahh. Ye ole debugger comes thru again.
The problem is probably stemming from my end. What I was doing was putting
a collection in a gridview. Then in the rowbound event casting a Event obj
instead of the EventColl obj.

the corrected code looks like this:

GCS.Business.Event.EventInfo mEvent =
((GCS.Business.Event.EventInfo)e.Row.DataItem);
int ownerGuid = mEvent.EventOwnerGuid;

Thanks.

"Chris Dunaway" wrote:
Are you getting an error? In what way is it not working as desired?

May 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Nick Jacobson | last post by:
Casting an 'enumerate' object destroys it?? Is that supposed to happen, or is it a bug? For example: a = e = enumerate(a) print dict(e) print dict(e)
3
by: ken | last post by:
I am getting this error from a gcc compile and I was wondering whether this was 100% valid. This seems a little extreme to me the c++ cast operators appear to only work on objects which defeats...
16
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have...
1
by: Roman Muntyanu | last post by:
Hi all, I created object of MyClass : ISomeInterface Then I created object of this class using reflection mechanism. ISomeInterface instance = (ISomeInterface)constructorInfo.Invoke(new...
14
by: Samuel R. Neff | last post by:
Why would you cast two strings to objects to compare them? I saw code in an MS sample on MSDN and don't get it. if ( (object)name == (object)attr.name ) { both "name" and "attr.name" are...
4
by: KC | last post by:
Could some one explain to me the casting rules for sending generic lists, ex. List<Person>, to a function that accepts List<object>? I cannot get the following easy-cheesy app to work. I get the...
4
by: gg9h0st | last post by:
i'm a newbie studying php. i was into array part on tutorial and it says i'll get an array having keys that from member variable's name by converting an object to array. i guessed "i can...
1
by: madumm | last post by:
Hi all I really need a solution for the following:: ------------------------------------------------------------------------------------- Say i have a font object called 'myFont' as shown below;...
21
by: phpCodeHead | last post by:
Code which should allow my constructor to accept arguments: <?php class Person { function __construct($name) { $this->name = $name; } function getName()
12
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
Hi, I have a class which "BiologySequence" which looks about like this. public class BiologySequence { private string _Sequence; public string Sequence {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.