Is there a way to retrieving the value in an auto complete box after a post of the page?
An example that does not work follows:
// POST: /Organizations/DeleteOrganization
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult DeleteOrganization(string querystring)
{
string errormessage = string.Empty;
OrganizationModel om = null;
if (!_provider.IsUserLoggedOn())
{
return RedirectToAction("LogOn", "Account");
}
AutocompleteTextBox myBox = (AutocompleteTextBox)ViewData["Organization"];
// ******* This does not work *********************
string orgid = myBox.Field("Value").ToString();
if (string.IsNullOrEmpty(orgid))
{
OrganizationProvider op = new OrganizationProvider();
om = op.GetOrganizationByName(orgid, out errormessage);
if (om != null)
{
if (!om.Destroy(out errormessage))
{
ModelState.AddModelError("", errormessage);
}
om = null;
}
else
{
ModelState.AddModelError("", errormessage);
}
}
else
{
ModelState.AddModelError("", "No organization selected");
}
return View(new OrganizationModel());
}