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 8414955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:18:18+00:00 2026-06-10T01:18:18+00:00

In Html (which I did not use) it’s <select> <option value=B>Bubblegum</option> </select> In (from

  • 0

In Html (which I did not use) it’s

<select>
<option value="B">Bubblegum</option>
</select>

In (from controller) Aspx it’s

[HttpGet]
public ActionResult ViewMethod()
{
//Populate DropDownList
Treats = new List<KeyValuePair<string, string>>();
Treats.Add(new KeyValuePair<string, string>("Bubblegum", "B"));
ViewData["treats"] = new SelectList(Treats, "Value", "Key", SelectedTreat);
return View();
}
[HttpPost]
public ActionResult GeneratedContent(SomeModel model)
{
List<HalloweenTreats> ChewingGums = StoredProc(model.SelectedTreat);
return PartialView(ChewingGums);
}

then in the View:

<% using (Ajax.BeginForm("ViewMethod", "ControllerName", new AjaxOptions { UpdateTargetId = "DisplayValues" })) { %>

<%: Html.DropDownListFor(x => x.SelectedTreat, ViewData["treats"] as SelectList)%>
<input type = 'submit' name = 'submit' value = 'generate' />
<div id="DisplayValues"></div>
<% } %>
<%: Ajax.ActionLink("Generate", "RequestReportSummary", "Report", new { model = Model }, new AjaxOptions { UpdateTargetId = "GeneratedReport" })%>

How to get the selected value “B” of Html.DropDownListFor in aspx engine for me to send it as a string in the database?

  • 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-06-10T01:18:20+00:00Added an answer on June 10, 2026 at 1:18 am

    The controller action you are posting to could take your model as parameter:

    [HttpPost]
    public ActionResult ViewMethod(SomeModel model)
    {
        // model.SelectedTreat will contain the selected value here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question, if you use the Html Helper from ASP.NET MVC Framework 1 it
I'm trying to extract text from arbitrary html pages. Some of the pages (which
I have HTML which includes scripts in following order <script src=../static/js/jquery.js type=text/javascript> <script src=../static/js/bootstrap.js
here is my sample html which is stored in a variable. var sHtml='' sHtml='<div
I have a header.html which start with session_start();. Then the following code, $_SESSION['cart'][$sw_id] is
I have a HTML which has lot of content and a vertical scrollbar appears
I place the .html (which consist of the .js web link) file in the
I have a base.html which has a login section at the top of every
I have an html page called search.html which contains sliders, they work perfectly in
Am attempting to dynamically create html which then injects itself as an iframe into

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.