Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Name:
Email:
Subject:
Message icon:

Verification:

shortcuts: hit alt+s to submit/post or alt+p to preview


Topic Summary

Posted by: asim km
« on: September 03, 2023, 11:38:55 pm »

Back to the view: we specify the model passed to the view. Next, change the title of the view: index to: videos Now write the following code after the title: Here we use (unordered list) to display a list of videos. As you can see, the code contains a mix of and code, thanks to the view engine! Please note that our code is prefixed with . This tells the view engine that this is code and needs to be executed. We use (list item) to render each video. Again, in this line, we mix the and codes. Here we just display the title and type of each video.

In more complex applications, you can have complex structures with a large number of sub-elements and display a large number of properties to the user. But it should be passed The process is exactly the same as what we did here. Therefore, you can take this knowledge and apply Phone Number List it to different scenarios. Note that when you enter: video title the properties of the video object are shown to you when you use dot notation.  the view's model on top of the view. If you don't do this, it won't work, and in some cases you may even encounter runtime exceptions.



That's all you need to do to get a list of videos from the database and display them to the user. We created a controller and wrote a few lines of code in the action, then created a view and used the block to display the video. Students also learned about Pictures Pictures Next, set the model behind this view on top: the Beaver model. Video We set the model to , since we will capture the object in this form. Now, write the following code in the view to create the form element: Here we use the syntax (note the ) to write the code. is a helper method that we use to render form elements.