We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Retrieving the value in an auto complete box after a post of the page

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());
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

    

 

 

 

 

 

 

 

 

 

 

 


1 Reply

VR Varalakshmi R.S Syncfusion Team November 2, 2012 05:51 AM UTC

Hi Marc,

 

Thanks for contacting Syncfusion forums.

 

We suggest you to use the AutoComplete controls ID at the post for getting the selected value. Please refer the below code snippet,

<code>

[View]

@using (Html.BeginForm())

        {

        @(Html.Syncfusion().AutocompleteTextBox("txtTest")

                .RequestMapper("ServerJSON").AutoFormat(Skins.Vista))

       

        <input type="submit" value="submit" />

}

[Controller]

[AcceptVerbs(HttpVerbs.Post)]

        public ActionResult Index(string txtTest)

        {

 

            return View();

        }

 

</code>

 

We have also prepared a simple sample to show case this behavior and the same can be downloaded from the following link,

AutoCompleteTextBoxPost.zip

Kindly try the sample and let us know if it helps.

 

Regards,

Varalakshmi


Loader.
Live Chat Icon For mobile
Up arrow icon