MVC Partial View with pagination in a WebForm - model-view-controller

How can an MVC partial view with pagination be included in a webform from a different application? Both applications can reside in the same domain. How do you handle the page links and the post back of the new page?

Related

issue regarding re direct from aspx page to mvc

I have used PostBackUrl(url) to re direct from aspx to mvc page .
Because
my aspx and mvc projects are on different domain.
its getting redirected but I have to refresh the page to go to "url".
Please give me some solution on how to re direct from aspx to mvc page
which are in different domain

Confusing about using angularJS with Codigniter

I'm new to front-end MVC and I decide to create a SPApplication then I found this angularJS. Of course, other MVC as well but I prefer angularJS.
Ok, my questions here.
Before this, I normally store my MVC files at backend MVC folders which is codeigniter view folder if it is html partial or page.
So is it the time to move the backend MVC to frontend?
Another question, what is codeigniterRest? do I need it to use with angularJS?
No, the backend MVC in CodeIgniter and the frontend MVC in Angularjs have a separate role totally.
The backend MVC will handle the data sent to the app by your frontend.
The frontend MVC in angularjs will receive a response (usually in json) from the backend MVC in CI and handle that data using its views and controllers.
So your Single Page App will consist of all the bells and whistles of CI + 1 view page (or more if you break that page into partial includes) that will store the angularjs app in it.

Two forms (one in layout and one in Page) how to handle in asp.net mvc3

I am working on a mobile website in ASP.NET MVC3. I have a page where i have search bar in my header. this header is coming from my Layout page which is common to all other Views. And inside my specific page, I have page specific content(forms).
For my Customer/Add action, I return the Add View of Customer which is strongly typed to my CustomerViewModel. I will have form tag in my Add View which will be posted to HttpPost Add Action method when form gets submitted. That is fine. My question is how will i handle the search box content ? I believe only one form is allowed in the page.So if i have a SearchViewModel which is binded to my Search View(Partial), It is going to be 2 forms in my page. So i can not do that.
I can handle the search part by reading the content in java script and calling another action to get Search results.Is that the only way to do that ? I am worried about those devices where java script is disabled. What should i do ? Please advice
No. You can have more than 1 form on the page. In fact, here you should. Your Add Customer page should submit to 1 action method, but your search form should submit to a different action method.
If you are familiar with webforms, that framework only allows you to have 1 form on the page, but not because HTML requires it. Webforms requires it because it is the only way the framework can carry all of the data from various server controls across POST requests (using ViewState). Webforms has historically not been very HTML or HTTP friendly.
You just can't have forms nested within other forms in HTML, but it is completely legal (and recommended in MVC) to have more than 1 form on a page.
As for AJAX, I would not worry about devices that do not have javascript enabled. There are only like 6 or 7 people on the planet that don't have javascript on their web devices, and if someone disables javascript, they won't be able to experience 99% of the rest of the web anyhow.

Asp.Net Mvc Account Controller JSon and View?

I m beginner asp.net mvc developer.And I don't understand,
Why has used both Json and ActionResult in Account controller(for register, login and etc.) in default asp.net MVC 4 project?
Thanks.
It's because in the ASP.NET MVC 4 the Login and Register forms are shown in a jQuery dialog and both forms POST to the Account controller using AJAX. The other actions that return views are similar to what existed in previous versions. For example if the user has javascript disabled he won't be able to use jQuery dialog and AJAX and he will fallback to standard HTML.
Do you means having both JsonResult and ActionResult for (register and login view) in default MVC 4 template?
It means two views for both Register & Login form. One is using with ajax and the other is as normal view.
eg: Click on "Register" link on top, it will popup ajax "Register" view.
Click on "Login" link on top -> click "Register", it will show as normal view.
Alariza,
As Darin pointed out, there are two action methods for each form (Register & Login). One action method is used for the popup version of the view and the other is for the normal view.
Don't get discouraged by the negative comments.

Mixing asp.net mvc controllers/views and static content management pages from database

I'm trying to build my first page using asp.net mvc3/razor which will mix pages showing entities like a list of news items and pages loaded from database created from a wysiwyg form (=content management page, cm). Therefore I would like all cm pages to use the same controller/view.
One "ugly" way to solve it is using a Pages action on each controller but I rather have a way to lookup if the link is an action or should be loaded from DB. Can I create routes like that? And if I can should I or is there a better solution?
For example if I have this structure
Home (Controller)
News (Action, page built up dynamically using list of news items)
About (Action, page from db)
Contact (Action, page from db)
Calendar (Action, page built up dynamically using a list of calendar events)
Orienteering (controller)
What is orienteering (Action, page from db)
I would like the url to the About page to be /Home/About not Home/Pages/About and the What is orienteering to be Orienteering/What-is-orienteering. These two pages are created from a wysiwyg editor in the gui by the users.
The News and Calendar should be loaded like standard controller/view page.
The bottomline is that I would like a base set of dynamic pages displaying structured data and on top of that the users should be able to create new pages from that GUI that is not controllers/view but loaded directly from the database.
I could create a Pages controller but then the URLs won't mirror the menu the user is seeing.
What is best practise in this case? :)

Resources