Hi,
In my requiremenet I get some values from JsonResult and get that in script.Now I have to show those values in a popup window each with a radio button,when user selects a particular radio button the particular text will be selected to a textbox then I need to send it to database.
I took a div and i am enabling this and not able to show the values,Please help me on this
here is my code
$("#divPartNums").show();
for (var len = 0; len < result.PartNo.length; len++) {
var markup = "" + result.PartNo[len] + " ";
$("tblPartNums tbody").append(markup);
}
$("divPartNums").append(tblPartNums);
$("#divPartNums").dialog({
height: 200,
width: 350,
modal: true,
});
}
$.ajax(options);
Manas MohapatraPosted Sep 15, 2017, 3:20 AM
Ram ChanPosted Sep 15, 2017, 12:32 AM
Kindly refer this
using System;
namespace bindingJSON
{
public class Squirrel
{
public string Name { get; set; }
public int? Age { get; set; } // squirrels aren't required tell us their age
public int Acorns { get; set; }
public char Gender { get; set; }
public string Hobby { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace bindingJSON.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
// Initial View
return View();
}
[HttpPost]
public JsonResult PostSquirrel(Squirrel incomingSquirrel)
{
string status = null;
try {
saveSquirrel(incomingSquirrel);
status = "If you don't see this, something went wrong.";
} catch (Exception e) {
status = e;
}
return Json(status);
}
#region privateHelpers
private Boolean saveSquirrel(Squirrel incomingSquirrel)
{
if (!incomingSquirrel.Age) {
// do something...
return false;
} else {
// do something positive!
return true;
}
}
#endregion
}
}
@model bindingJSON.Squirrel
@{
Layout = null;
}
"en">
oh hey, a squirrel!
we should interview it!
If the squirrel cooperates, record their information and send it to our server.
"text" required="required" id="Name" placeholder="Enter the squirrel's name" />
"number" id="Age" placeholder="squirrel's age (optional)" />
"number" required="required" id="Name" placeholder="How many acorns do they own?" />
"number" required="required" id="Name" placeholder="M or F? (single letter only)" size="1" />
"string" required="required" id="Hobby" placeholder="How many acorns do they own?" />
"btnSubmit" type="button" value="launch the squirrel through the internet!" />
Krishna Rajput SinghPosted Aug 24, 2017, 9:12 AM