mvc ajax开始表单和renderpartial验证打开

时间:2012-09-21 06:57:20

标签: partial-views renderpartial

我正在使用ajax开始形式的视图。 ı搜索一件事,结果是正确的,然后警告不渲染局部视图。但它没有呈现正确的视图空白页面和看到我的局部视图。感谢

我的观点

   @using (Ajax.BeginForm("AjazKullanici", new AjaxOptions { UpdateTargetId = "trBilgiler", HttpMethod = "Post" }))
    {
        <tr>
            <td style="width: 20%">
                T.C. Kimlik No :
            </td>
            <th align="left">
                @Html.TextBoxFor(model => model.TcNo)
                @Html.ValidationMessageFor(model => model.TcNo)
                <input type="submit" id="btnBilgiGetir" value="Bilgi Getir" class="Button" width="75px" />
            </th>
        </tr>
    }
    <tr id="trBilgiler">
        @{Html.RenderPartial("BilgilerKullanici");}
    </tr>

我的控制器

  public ActionResult AjazKullanici()
    {

        ViewData["dropGizliSoru"] = _db.EHASTANEGIZLISORUs;
        return View();
    }

    [HttpPost]
    public PartialViewResult AjazKullanici(YeniKullaniciModel model)
    {
        if (model.TcNo != null)
        {
            var userKontrol = _db.KULLANICIBILGILERIs.Where(x => x.KULLANICIKOD == model.TcNo);
            if (userKontrol.Any())
            {
                Response.Write("<script langauge='javascript'>alert('Girmiş Olduğunuz T.C. Kimlik Numarasına Ait Kullanıcı Kaydı Vardır.')</script>");
                return PartialView();
            }
            else
            {


                return PartialView("BilgilerKullanici",model);

            }
        }
        return PartialView();
    }

0 个答案:

没有答案