ВалькирияН
Дата: 03.05.2017 08:22:56
public ActionResult Index(string searchString)
{
int rez;
if ((!String.IsNullOrEmpty(searchString)) && searchString.Length == 13 && (int.TryParse(searchString.Substring(2,5), out rez)) && searchString.Substring(0, 2)=="21")
{
App_BarcodeItem a = db.Barcode.Where(b => b.Barcode == rez).FirstOrDefault(); //ToList().Count();
if (a!=null)
{
ViewBag.Massage = "Есть";
ViewBag.Desc = a.Description;
int.TryParse(searchString.Substring(7, 5), out rez);
ViewBag.Weight = rez/1000.000;
}
else
{
ViewBag.Massage = "Нету";
try
{
App_BarcodeLog bLog = new App_BarcodeLog()
{
Barcode = searchString,
UserCheck = User.Identity.Name.Replace(@"HCLASS\", ""),
DateAdd = DateTime.Now
};
db.BarcodeLog.Add(bLog);
//db.Application.Add(applicationGet);
db.SaveChanges();
//return RedirectToAction("Index");
}
catch (RetryLimitExceededException /* dex */)
{
//Log the error (uncomment dex variable name and add a line here to write a log.)
ModelState.AddModelError("NotValid", "Невозможно сохранить. Попробуйте снова, если проблема повторится, напишите на Problems.");
}
}
return View();
}
ViewBag.Massage = "Некорректные данные";
return View();
}
searchString содержится в поле TextBox
<p>
Поиск ШК: @Html.TextBox("searchString")
<input type="submit" value="Поиск" />
</p>
Мне нужно сделать так, чтобы поле после вывода информации, очищалось и можно было вводить новый штрих код, с помощью Clear, не получается.
ВалькирияН
Дата: 04.05.2017 07:01:43
Подскажите, пожалуйста, хотя бы на каком шаге организовать удаление? перепробовала очень много всего, выдает ошибку