I want to generate menu from database for that I have implemented my logic and its responding well, the issue is that I am unable to render menu from my controller method. I want to ask if its possible to return HTML from action controller method and render it on my view by using Html.Action("MenuGenerator","Menu") but I am unable to achieve this. Moreover I donot want to create partial view for menu since my method returns menu as html string and I just want to flush it out to the view.
Html.Action is a basic helper method. All it does is return a MVCHtmlString. You will have to create your own helper extension that returns your custom HTML to build your menu.
Related
I've got the following problem: in Sitefinity (9.1, Feather) I need a form, which can call 3rd party API (Mandrill) once submitted.
As far as I understand, I need some kind of custom widget or something.
Any help would be very appreciated.
Thanks
I would start here. You don't necessarily have to create a separate class library for creating the custom Feather widget (you can just put it in the SitefinityWebApp web project), but you can if you like. With Feather/MVC widgets you basically get a Controller and View, with an optional Model class to play with too.
In your scenario, you'd probably have a Controller with two actions: Display the form, and handling the form submission. In your form submit action you'd then call Mandrill to submit the data (or do whatever it is you need to do). In your Controller you're in C# purely, so you can do whatever you like there.
Im new to umbraco, Im using a umbraco surface controller to enter data to database , Normally i use #Html.ActionLink to call to action methods like delete,edit,details etc. Above function cannot be used in umbraco so i want to know how to do that kind of thing in umbraco?
If you have an IPublished item you can just call item.Url inside the href of an anchor tag. this would do the trick.
I have two registration types. One is Individual and second as Business type registration.
I have two radio buttons. I have used Html Helper for this. When I click on first radio button
the individual partial view should be loaded. How can I achieve this using ap.net mvc4 razor
Use AJAX to make a request to the controller within a radio button's change function. In the controller action with an HttpPost or HttpGet decoration, you would return a partial view. Within your ajax response you would recieve it as dataType:'html' and place the result inside of a div.
Google is your best friend when you're learning.
I'm converting my site from using jQueryUI to jQuery Mobile, and I'm having some trouble.
I have a page that lets users add new timesheet entries. They click the "Add" button and it retrieves a Partial View from the server right onto the page.
The problem is that jQuery Mobile is not applying to any of the elements in the Partial View.
How can I force jQuery Mobile to process my elements after they've been inserted into the page?
The short answer is that you can just trigger the create method on the parent element of where you inserting your partial view.
For example $('#container').trigger( "create" );
Alternatively most widgets can be manually initialized by calling them on the element, for example for a listview: $('#myListview').listview(). This can be useful if you have only a few elements that need to be enhaced and you don't want to traverse all the child elements of the container. You should also know that for many widgets there is also a refresh method which you can call if you add elements to it after it has already been initialized for example $('#myListview').listview('refresh).
Also have a look at the following Q & A from the JQM docs which deals with this issue and for an explanation as to why it is necessary to call these methods.
Question: Content injected into a page is not enhanced.
Answer:
jQuery Mobile has no way to know when you have injected content into a
page. To let jQuery Mobile know you have injected content that must be
enhanced, you need to either make sure the plugins are called to
enhance the new elements or trigger("create") on the parent container
so you don't have to call each plugin manually.
I am using MVC 4 with some Kendo UI and I am new to both.
What I need is for my Kendo grid to redirect to another page when a row is clicked.
My initial thought was to create a function within the script section of the view that the grid is on and that function would call the other view that I need. However, I am not sure if this is possible because I believe the view is supposed to be separate from the controller.
I think that I need to somehow make all of this be able to work from within the controller but I am not sure how to get started.
Use #Ajax.ActionLink to call controller and receive partialView
If you are doing a post action you can use RedirectToAction() in your controller. If you need to change the window in JavaScript see below.
window.location.href = "#Url.Action("(Action)","(Controller)",new {id= (params)})";