Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 24, 2007 04:03 PM by sergiopereira
Dec 17, 2007 12:14 PM|LINK
I don't have Intellisense in .aspx files for ViewData although it's working.
Dec 17, 2007 12:31 PM|LINK
Not sure which edition of VS you are working with. Please see if
http://forums.asp.net/t/1192768.aspx post helps.
Dec 17, 2007 02:26 PM|LINK
Do you meant that no intellisense at all comes up? Or you only get the "object" members such as ToString() and GetHashCode() ?
To get strongly typed ViewData, your ViewPage needs to be ViewPage<T> (where T is the type that you want to consume on the page itself)
Dec 17, 2007 02:36 PM|LINK
Thank you for your help. I think the last post gives me the answer.
I am currently using VS 2008 Standard Beta 2 and this should be the problem.
I know that my ViewPage needs to be ViewPage<T>. Anyway, thank you having taken time to answer me.
Dec 22, 2007 05:56 PM|LINK
Dec 24, 2007 06:55 AM|LINK
Thank you for your answer.
I tested the code you provided: it works. Why don't I have Intellisense for variables declared in Code Behind?
Dec 24, 2007 11:44 AM|LINK
Dec 24, 2007 04:03 PM|LINK
You should place all your code in a controller instead of WebForms' code behind if you want to use MVC pattern.
My understanding is that the code behind still has use. Just be careful to limt your code behind to UI logic and leave any model retrieval and business logic in the controllers. It's perfectly fine IMHO to have code like this in the code behind:
myRepeater.DataSource = ViewData["Products"];