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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

105522 Nov 1,2012 04:25 PM Nov 2,2012 01:51 AM ASP.NET MVC (Classic) 1
loading
Tags: Tools
Marc Oden
Asked On November 1, 2012 04:25 PM

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

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

    

 

 

 

 

 

 

 

 

 

 

 


Varalakshmi R.S [Syncfusion]
Replied On November 2, 2012 01:51 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;