Note that there are some explanatory texts on larger screens.

plurals
  1. POAn object specified for refresh is not recognized
    primarykey
    data
    text
    <p>I have a update function like this:</p> <pre><code>public void Update(HomeBanner homebanner) { homebanner.EnsureValid(); DataSource.DataContext.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, homebanner); DataSource.DataContext.SubmitChanges(); } </code></pre> <p>And i write a update controller</p> <pre><code>[AcceptVerbs(HttpVerbs.Post)] //[ValidateAntiForgeryToken] [ValidateInput(false)] public ActionResult ManageImages(int ? id,FormCollection form) { HomeBanner homebanner= BannerRepository.RetrieveById(id); this.TryUpdateModel(homebanner); string photoName = saveImage("photo"); if (photoName != string.Empty) homebanner.ImageID = photoName; BannerRepository.Update(homebanner); return RedirectToAction("list", "Admin"); } </code></pre> <p>and then the view:</p> <pre><code>&lt;% using (Html.BeginForm("ManageImages", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" })) {%&gt; &lt;h3&gt;Manage Images&lt;/h3&gt; &lt;div class="label-field"&gt; &lt;label for="ID"&gt;Chọn vị trí:&lt;/label&gt; &lt;%= Html.DropDownList("ID", DataHelper.Banner().ToList().ToSelectList("value", "name",Model.HomeBanner.ID.ToString()))%&gt; &lt;/div&gt; &lt;div class="label-field"&gt; &lt;label for="photo"&gt; Chọn hình&lt;/label&gt; &lt;input type="file" name="photo" value=""/&gt; &lt;/div&gt; &lt;div class="label-field"&gt; &lt;label for="Link"&gt; Liên kết&lt;/label&gt; &lt;input type="text" name="Link"/&gt; &lt;/div&gt; &lt;p&gt; &lt;input type="submit" value="Lưu" /&gt; &lt;/p&gt; &lt;% } %&gt; </code></pre> <p>It get data as well but update step is not success: It mark right here</p> <pre><code>DataSource.DataContext.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, homebanner); </code></pre> <p>and throw exception: <strong>An object specified for refresh is not recognized.</strong> I dont know why, i see data filled to object when i debug. Plz someone help me!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload