ok the thing is that when i click delete on the view list page i want to set focus on the acknowledgment displayed there . delete is a ajax link . how would i do that?
Set focus on on ASP.NET MVC model errors
This will help you..
Related
I am a newbie, i am trying to create a view where every time i click on add more link next to a Textbox, another text box appears. How do i do that? I searched the same question on this site but i could not find a solution.
You'll have to create an array (string[] Smth)in your model. Then you have to make your "add more" link to submit your form to controller action that will add another element to this array and roundtrip back to view.
You may take a look at the following article which illustrates how you could handle dynamic rows.
I have a ASP.net MVC application. On one page I have a button and when user clicks on it I need to display some information on a pop up window. How can I do that in ASP.NET MVC? What do I use and where do I write the code for pop window? In the controller? Some java script?
Thank you!!
You can display messages with javascript. The content of the message can be set in the markup or by your Controller as a Model property. You have a few display options:
Use the alert() function, which will display a native browser dialog
Display a styled modal dialog (E.g. jQuery UI dialog)
Display a styled div (E.g. jQuery UI Message - shameless plug, this one of my open source projects)
The alert function isn't very pretty, but it's the simplest. I typically go with a modal dialog or a styled div, depending on the UI requirements.
If the information you want to display in a pop up is dynamic (i.e you need some c# logic to run) then I'd suggest putting that logic in a controller and have the corresponding view be the pop up itself. You can stick some JavaScript at the top of the view to launch the popup on load.
The page with the button trigger can call that controller and pass any data needed. To make it smooth maybe make the trigger use Ajax.
I am new to Rich Faces and we are using richfaces 4.0. We are having an pop up requirement in our project and we used rich:popupPanel.
In the pop up we are having a form with 5 to 10 input text boxes and selectManyCheckbox components.
Whenever the user opens the pop up, fills the data and click Save, the data is being saved properly.
But when the user opens the pop up again, the already entered data is being displayed, actually it should be an empty form.
Can anyone help me on this?
Thanks in advance.
It is probably because the backing bean that supply the values to your controls in the rich:popupPanel is in the session scoped and you forget to clear these values in the action method when the save button in the rich:popupPanel is pressed.
Please check if you really clear these values in that action method
I have a view with a textbox and a search button, eg CustomerTextBox and CustomerSearchButton.
The list of customers is too long to display in a dropdown, and there has to be advanced search functions anyway.
What is the best practice in MVC to handle this case? When the user clicks on the search button, should it:
A. Load another view into a modal popup (eg /customers/search)?
B. Have the search form in a hidden div that expands when the search button is clicked?
C. Redirect the user to a search page by means of RedirectTo("/customers/search")?
I've only been doing MVC for 3 days so thanks to those who answer my questions that might have quite obvious answers that I cant see yet. :)
I think it's really up to you, what would fit your site better? If you need some advanced searching capabilities, create a /customers/search and redirect to it. If its somewhat simple and quick, use a modal popup, or expand a hidden div with a search field or two when clicking the button.
Check this out:
How to implement search features in ASP.NET MVC applications
I have 2 radio button with values New & Existing. If user chooses New, then I show a textbox on the form and if Existing a dropdown and textbox is hidden. The question is , does the hide/show of the textbox/dropdownlist have to be written in the View or the Controller class? Also when I choose the selection my whole form is posting back and hence all validation error msgs are being shown which should not be shown nless the save button is clicked, how do I a partial postback without full form submission? Any code snippets or urls would be benificial in this respect.
The question is , does the hide/show of the textbox/dropdownlist have to be written in the View or the Controller class?
Just show/hide with jQuery that.
Also when I choose the selection my whole form is posting back and hence all validation error msgs are being shown which should not be shown nless the save button is clicked, how do I a partial postback without full form submission? Any code snippets or urls would be benificial in this respect.
Perform 'partial postbacks' through javascript.
Post form to save action only once when it's ready (when Save button is clicked).
Some resources:
jQuery tutorial
jQuery AJAX
About form AJAX`ifying
If I understand you correctly, the answer is the hiding and showing of controls should be done on the view as it's display specific.
If you use javascript to show and hide the controls then because it's on the client side you would not have to postback the form, and could do server side validation when the save button is clicked.
jQuery is very good: Jquery Website
Hope that helps?