Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 10th, 2011, 03:01 AM
Authorized User
Points: 403, Level: 7
Points: 403, Level: 7 Points: 403, Level: 7 Points: 403, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2009
Location: Kolkata, India
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default Anonymous types

I am using a LINQ to get some value from database and show in gridview. I dont want every feilds in my gridview, that is way I use anonymous type and reduse some feilds. Now I want to cast the data to a strongly type class. But I can not do that. Please help me...
__________________
Happy coding...

Arnab Roy Chowdhury.
  #2 (permalink)  
Old January 10th, 2011, 03:53 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

You can't do that....

What you could do is create a simple, strongly typed class with public properties and then copy over the data from your anonymous types into your custom class. MVC uses this concept a lot with ViewModels.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #3 (permalink)  
Old January 10th, 2011, 04:15 AM
Authorized User
Points: 403, Level: 7
Points: 403, Level: 7 Points: 403, Level: 7 Points: 403, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2009
Location: Kolkata, India
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok..Thanks...
__________________
Happy coding...

Arnab Roy Chowdhury.
  #4 (permalink)  
Old January 10th, 2011, 04:30 AM
Authorized User
Points: 403, Level: 7
Points: 403, Level: 7 Points: 403, Level: 7 Points: 403, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2009
Location: Kolkata, India
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Default Page life cycle.

I am using some user controls in my aspx page. User controls have some events. Where is the best place to register a event with handler method in page life cycle?
__________________
Happy coding...

Arnab Roy Chowdhury.
  #5 (permalink)  
Old January 10th, 2011, 04:31 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Can you please start a new thread for a new topic? I don't see how this is related to anonymous types...

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Working with Queries and Anonymous Types guynorton ASP.NET 3.5 Basics 1 October 10th, 2010 03:12 AM
Chapter 13:page 439,Queries and Anonymous types Arya BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 February 2nd, 2010 11:22 PM
Anonymous Shopping Cart Greathouse BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 August 17th, 2009 12:57 PM
About Anonymous Identification Lee Dumond BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 15 December 14th, 2008 05:12 PM
Get my Anonymous username or userID Maxxim ASP.NET 2.0 Professional 7 October 21st, 2007 08:17 AM



All times are GMT -4. The time now is 04:33 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.