February 8th, 2013, 07:03 PM
How to convert Forms to MVC???
Is there a way that I can convert this Tutorial to MVC?
I managed to separated everything except the Form data.... I didn't know how to go about it.
<asp:Repeater ID="VideosRepeater" runat="server"> <ItemTemplate> <%# Eval("Title") %> <br /> <object width="427" height="258"> <param name="movie" value="http://www.youtube.com/v/ <%# Eval("VideoId") %>"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <param name="wmode" value="opaque"></param> <embed src="http://www.youtube.com/v/<%# Eval("VideoId") %>?" type="application/x-shockwave-flash" width="427" height="258" allowscriptaccess="always" allowfullscreen="true" wmode="opaque"></embed> </object> </ItemTemplate> <SeparatorTemplate> <br /> </SeparatorTemplate> </asp:Repeater>
February 12th, 2013, 04:13 AM
You have to use html tables in mvc instead of repeater. You have to modify your code like below:
1. In your view, use foreach loop to bind data to columns:
@foreach (var m in Model)
<td style="border: 1px solid #000000; height: auto; padding: 5px; text-align: center; vertical-align: middle;">
2. In your view, declare model as IEnumerable:
3. In your controller
a. Declare list as IEnumerable.
b. Create a private list function to get values from dataset and add to list declared previously.
c. In Actionresult function, call the private function.
March 2nd, 2013, 01:36 AM
I am currently in the process of converting a couple of web form projects over to MVC. At first it was more to get familiar with the MVC, but now I actually really like how the model and the separation it provides.
The transition over has been a little hard in some area's in that there really isn't a lot of material other than some blogs, stackoverflow, and a couple of video casts. There are two books that are semi-available but, one is already kind of useless in that there have already been a number of changes to the framework that there are better ways in handling some things.
I also think you will have to really start to learn jQuery if you are already not familiar with it too. So for me - I feel like I am really learning two things as I've been doing this.
But worth it over all, I would say yes. And I think that converting a small project over is also really a great way to start.