I have an HTML form that handles some basic information. When the button for completing the form is clicked, I have a popup asking for additional information that appears (this is a div that is hidden until button click event). What I want to know is if there is a way to link those two forms together so that a final submit will POST all data on both forms?
Ideas I've Considered:
On button click, pass the 11 fields from form one into 11 hidden fields from form 2.
On final submit, create my own post call via javascript.
Both of these would work, but seem sort of hacky to me. I'd rather have a true method of linking two form submits if there is one. Anyone?
Why not just make the first button a NON ASP.NET button (i.e. just a regular HTML button)... with an onclick event which shows the hidden div. The Submit button on the hidden div would be the ASP.NET button which submits the entire form (data from both parts) to your ASPX?
Related
I'm using telerik Grid which has a command button that adds new row/record or another command button that edits selected row/record.
Each grid is inside a twitter bootstrap tab content (Yes, I didn't use telerik tab). What is happening is that when one of buttons that I mentioned above clicked, I expect the tab that contains that button be active at page load.
So is there anyway to get that button so I can use it to activate the proper tab? (ID of that button is enough for me, I will do the rest with jQuery)
Every control that posts back, in an ASP.NET web forms world, sets the __EVENTTARGET and __EVENTARGUMENT (if there is an argument) form values. The __EVENTTARGET form variable has the client ID of the button, so that might be the optimal way. If it's within the grid, I'm not sure, but the __EVENTTARGET may either be the button or grid ID.
Ok, so I've researched this to the end of the earth and can't seem to find a solution that works.
I have a C# application, which is basically a web form made up of radio button lists and text boxes in an update panel. The form has multiple 'sections', each of which the user submits when completed. Each control performs a postback. This is because if the user modifies a section after completing it, the 'section saved' label needs to disappear.
This all works well, except the postbacks lose the tab order of the controls. I have found code examples that save the last control that had focus, which works well for the radio button lists, but because the text boxes post back when a user tabs to the next control (not modifies the text), it doesn't select the next control. The user has to hit tab again and it jumps to the third text box, not the second because technically, the second text box is what had focus after the initial postback. I hope this makes sense.
Any ideas? I can post code if required.
I should probably also add that this page is within a frame of our community portal.
I'm using an asp.net MultiView control with 2 Views inside.
First view has a "create" button to create new customer. Clicking the "create" button will display the 2nd View of the MultiView which allows to enter customer information.
Second view has a "return" button to return back to the 1st view.
The problem is: after creating the first customer, clicking the "create" button again will render the 2nd view with first customer's information already entered.
Is there a way to reset 2nd view to its default state whenever the "create" button is clicked?
Perhaps, clearing out the viewstate?
Currently I'm using a recursive method to clear out all the inputs (textbox, radiobutton, dropdownlist, etc.). I just want to know if there's a cleaner/better way.
Thanks
Easiest way to do it is to have the return button do a response.redirect to the same page. It won't be terribly inefficient and you won't wave to manually reset anything.
You could possibly use OnClientClick on btnReturn to simulate a click on a hidden <input type="reset"> button.
Multiple forms submit with C# MVC.
The company I work for has taken the approach of having multiple forms submits being done using jquery submitting different forms on different button clicks. My concept should be pretty simple. I have a text box sitting in a form that holds the quantity of items to purchase. I have two separate buttons, one for adding to cart and one for adding to wish list.
The jquery submits the form, but the formcollection in the MVC code does not have any form data.
Is My jquery not submitting the form? Or not submitting the hidden fields?
if you are sure form is submitted then i suppose there is some problem in the view. all inputs should be submitted for sure, even if they are not visible (e.g. style="display:none;"). i could be more specific if i would see the view.
Check the Action signature in the Controller and be sure that you're using the right parameters' name.
Just for curiosity, why you're not using ajax for this ? (#Html.BeginAjaxForm () )
I have a Ajax modal popup that displays a set of options for the user. On submit button click event on the ajax modal popup, i need to pass the user selected data back to a text box on the user control (which has the modal pop up) on the calling page.
Structure/flow is as follows. There is a page and two user controls. One is a search control that has another user control that contains the user options. The master page has the search user control. When the user chooses an option in a dropdownlist in the search control, it does a mpe.Show of the user control with options. User makes his selections and hit submit button. In the button click event in the popup, i delegate an event back to the search user control which tries to set the value in one of its text boxes. Everything is going fine until this step and i can see the value but the text box never changes. It seems like the user control is already rendered and the changes are ignored. Any idea how I can get around this?
In short, how to get back the data to a control from an Ajax modal popup.
Use jquery - when the user clicks a button on the modal - use jquery to set the value field to be the data that the user has selected.
e.g.
$('#modalButton').click(function() {
var userData = $('#tbUserData').val();
$('#textBoxElsewhere').val(userData);
});
for anybody's future reference, i did a work around for this. What was happening is that, on the final button click postback, the page/parent user control load events run first and then the button click event.. so the changes that were being made in the button click event did not make it back to the parent user control on the page.. i had to add a middle step to display the user selections for approval and force the user to hit a final confirmation hit. On that post back, the changes were already available for the parent user control, and not have to wait for the button click event to trigger to grab the data. I'm sure there is a better way to do this but this is what I could come up with.