Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6893467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:39:45+00:00 2026-05-27T06:39:45+00:00

I have a page, it has a drop down list, which contains the names

  • 0

I have a page, it has a drop down list, which contains the names of objects to edit. I have this working so that when you select an item, an AJAX call loads the text and it shows in a textarea. Now I want to do ‘save’, ‘save as’ and ‘delete’ buttons, which would make their own AJAX calls to do the obvious. The Save As would need to use jquery to show a popup to ask for the name to save as. In each case, I want to pass data that is in elements outside the form, to the server. I can’t have all three buttons in different forms, all contain the text area to pass the text in, and I need the selected value from the drop list, which is already it’s own form, outside the form that contains the text area. I can see how I could use one AJAX call and pass all sorts of data that needs parsing to work out what I should do with it, but that seems ugly to me. Is there a neat way, perhaps using JSON ( not not necessarily ), that I can pass the values of controls on my page, but outside my form, in to an AJAX call ?

So for example, I have this:

    @using (Ajax.BeginForm(new AjaxOptions 
   {
       Url = Url.Action("GetCoupon"),
       OnSuccess = "OnLoadSuccess"
    }))
    {
           @Html.DropDownList("ddlCoupons", 
          Model.Coupons.Select(a => new SelectListItem { Text = a.Name, Value = a.CouponId.ToString() }), 
          "--Empty--",new{
          onchange = "OnSelectCoupon();"
    });
       <input type="submit" value="Load" id="sbmtCoupon" style="visibility:hidden"/>
   }

now, this works. But then I have another AJAX form:

@using (Ajax.BeginForm(new AjaxOptions
 {
     Url = Url.Action("SaveCoupon")
 }))
{
    <input type="submit" value="Save" />
}

I want to pass the selected id of the drop down list, and the text of a text area, to this AJAX call. Right now, I am adding some hidden fields and handling change events to fill the fields in each form ( there’s three actions ), so they send what I need, but I’d like to just have some javascript run to build the value passed in, by searching for values across the form.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:39:45+00:00Added an answer on May 27, 2026 at 6:39 am

    cant say that i have understood your question but it seems like you need to prevent the default posting of from you can try something like

    i assume these are the only botton on the page, so hook them up to the click event

    $("button").click(function(e){
    e.preventDefault(); //prevent the default behaviour of the form 
    var buttonpPressed = $(this).data("val");  //get which button is pressed
    var valueOfField = $("#idOfyourDDL").val();
    $.post("/Home/Index",{buttonPressed:buttonPressed,value:valueOfField},function(data){
    //this is the callback which will execute upon successful ajax post
    alert(data.actionPerformed);
    },'josn');
    });
    
    [HttpPost]
    the ActionResult would look like
    
    public ActionResult(string buttonPressed){
    
    if(buttonPressed=="saveas"){
    // perform some action
    return Json(new{actionPerformed="saveas"});
    }
    else{
    //perform someother action
    return Json(new{actionPerformed="save"});
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page on my site which has multiple drop down boxes as
I have a page which has a drop list inside a form. The drop
I have an iframe which contains a few select drop-down lists for data entry.
I have a page that has two drop down lists on it and a
I have a page which has an Iframe. In that Iframe, there are six
I have a drop down which has a method which binds data to it:
i have a drop down list contains the name of reports and each report
I have a form in an ASP.NET MVC project which has a select drop
Say that I have a web user control that has several drop down lists
I have a combo box(drop down list) and a text field on the page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.