How do I enable/disable the ActionLink html helper in mvc4? - asp.net-mvc-4

In my project, there are five navigation links, represented using #html.ActionLinks as Partial view.Every link represents a different page. When the user is at first page all the links should be disabled
when the user is directed to second page on clicking a button, only first link becomes active and other all links remain inactive.
In every view I am calling this partial view by #html.RenderPartial("_partialViewName")
So how can I change the behavior of ActionLinks dynamically in a controller?

Related

How to Change /SignIn, /SignOut , and /Account pages parent page or Add these page to a child of custom page instead of Home?

I'm using a PowerApps portal that has login and logout pages which has parent page as home. But I need to change the parent page to my custom page. Is it possible to change the parent page?
Because in our scenario all page URLs should be derived from a custom page. Can you please help as soon as possible.
Now the URL is https://xxxxx.powerappsportals.com/en-US/SignIn
I want to achieve like https://xxxxx.powerappsportals.com/en-US/yyy/SignIn - yyy should be my custom page partial URL.

SAP Spartacus Create login popup

I neet to create registration/login popup.
The header component is on all pages.
I have login btn in header.
I have page /login/register with a slot BodyContentSlot-register
I don’t know how many components can be added to BodyContentSlot-register, but I need to click on the icon in the header to show the registration form in a modal window without going to the registration page. And show in a modal window all the components of this slot.
To achieve directly what you've described:
In the modal:
you need to make a call using CMS service to get page data (that calls backend for CMS page data) OR get the data if you've loaded it before (as an optimizaiton only)
display the slot's content you want to show, i.e. using cx-page-slot component statically in your modal and passing the position as an input
The tricky part is that this component gets from CmsService the slots of the current page, i.e. cart page (based on routing /cart), but not the page data you've loaded programatically in your modal. So you need to customize CmsService to return you the CMS data for specific slot of given page (register), even if it's not a part of current page data.

How to load Partial Views using Radio button in mvc4 asp.net razor?

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.

How to use/handle a loader in an MVC app?

in a ASP.NET MVC application that I am currently working there are multiple places in a single page that the user can click. So there is a main menu that's in _layout and for each inidividual page there can be links associated with that page.
I am trying to use a loader which will be shown on every click, mainly where the response takes time but for now it's for every click.
For example in the home page, from the main menu the user can click Students and the loader should come up and hide when the page loads completely. On the students page there can be an ajax call that gets data and binds it to the grid.
So from the time the user clicks on a menu link and the page loads the loader is active/shown. It's hidden once the page loads completely.
The grid can have editing functionality and when the user clicks on any of the CRUD links the loader should show and hide.
I am looking at suggestions on implementing this requirement.
If I can hookup any of the MVC events, that would be cool as I want less of Javascript/jQuery stuff but if Javascript/jQuery is the way then that's fine too.
Currently I don't have anything so anypointers are appreciated.
Assuming AJAX is being used
I don't see a way to keep this server-side without a middle page with a redirect being used (which would just be unnecessary bloat). And, since you're not opposed, you can implement this fairly easily using jQuery and something like blockUI.
I'll let you play with refining the binding to only links you care about, but for now we'll assume all links. Also, MVC should be using jQuery for things like Ajax.Actionlink so we can hijack events like $.ajaxStart and $.ajaxStop:
function showLoadingScreen(enabled){
return enabled ? $.blockUI() : $.unblockUI();
}
$(document).ajaxStart(function(){
showLoadingScreen(true);
}).ajaxStop(function(){
showLoadingScreen(false);
});
Later on you can maybe apply classes to the links you care about and just bind to them (instead of $.ajaxStart) but I'll leave that up to you.

Partial view is not updating image in ASP.NET MVC4

I have a view on which two partial views are rendered.One partial view(lstContactPerson) contains the List of contacts(image and other details) and action buttons for View/Edit/Delete.On Edit button-click details of a record is rendered in another partial view(Contact) for edit. After submitting Contact form the details are updated but not an image on lstContactPerson view without reloading the page.
I have searched for this and found that issue must be of caching and i implemented most of cache removing/Disabling stuff but issue is not resolved.
try adding some random value to image url. it will ensure that image is not fetched from browsers cache
http://yourimage.png?nocache={GUID}