In Scott's
post here, his example uses WebControls (Repeater and Literal). Under his header "Implementing Our View Using Server Controls" his example references these controls in the CodeBehind page. I am unable to do this with
the release, the codebehind page cannot find the controls referenced anywhere. Shouldn't it be creating a MyView.designer.cs file like the standard Web Forms does?
I've experiencing the same problem. Regardless of the type of control I drop onto the ViewPage designer I cannot access any of them in the code-behind.
I just found a fix. Right click on your web project and select "Convert To Web Application" after every time you add a new view. ScottGu has confirmed this issue, and hopefully will be fixed in the next version.
http://www.heliosfx.com
Marked as answer by Haacked on Dec 12, 2007 05:48 AM
Yes, this is an issue missing in the VS proj templates for the default pages (views). Basically the *.designer.cs file allows the Control ID's to become fields that you can program against in the code-behind. Although not well-named, the command listed above
"Convert to Web Application" should give you the designer file required.
Simon
This posting is provided "AS IS" with no warranties, and confers no rights.
mxmissile
Participant
1617 Points
372 Posts
Server Controls and Code Behind
Dec 10, 2007 06:04 PM|LINK
In Scott's post here, his example uses WebControls (Repeater and Literal). Under his header "Implementing Our View Using Server Controls" his example references these controls in the CodeBehind page. I am unable to do this with the release, the codebehind page cannot find the controls referenced anywhere. Shouldn't it be creating a MyView.designer.cs file like the standard Web Forms does?
ddahlem
Member
4 Points
2 Posts
Re: Server Controls and Code Behind
Dec 11, 2007 03:31 PM|LINK
I've experiencing the same problem. Regardless of the type of control I drop onto the ViewPage designer I cannot access any of them in the code-behind.
mxmissile
Participant
1617 Points
372 Posts
Re: Server Controls and Code Behind
Dec 11, 2007 03:57 PM|LINK
I just found a fix. Right click on your web project and select "Convert To Web Application" after every time you add a new view. ScottGu has confirmed this issue, and hopefully will be fixed in the next version.
ddahlem
Member
4 Points
2 Posts
Re: Server Controls and Code Behind
Dec 11, 2007 04:02 PM|LINK
Thanks for the update[:)]
SimonCal
Participant
1910 Points
384 Posts
Microsoft
Re: Server Controls and Code Behind
Dec 11, 2007 07:48 PM|LINK
Yes, this is an issue missing in the VS proj templates for the default pages (views). Basically the *.designer.cs file allows the Control ID's to become fields that you can program against in the code-behind. Although not well-named, the command listed above "Convert to Web Application" should give you the designer file required.
This posting is provided "AS IS" with no warranties, and confers no rights.