开发者

manually updating database table values are not reflecting in webpage - aspnet mvc

i noticed some wierd problem i.e i have built a web page on which information comes from database table named "school", when i change some data in that table manually from mssql the web page data is still same 开发者_如何学运维as previous, its not gettin' changed, i dn't know how it is possible.

this is my action controller


    public ActionResult SchoolDetails(string id,_ASI_School schoolDetails)
    {
            schoolDetails = SchoolRepository.GetSchoolById(id);
            return View(schoolDetails);
     }

This is my view


    =Html.Encode(Model.SchoolName)
    = Html.Encode(Model.SchoolAddress) 
    = Html.Encode(Model.SchoolEmail) 

code for GetSchoolById()..


   private static ASIDataContext db = new ASIDataContext();
   public static _ASI_School GetSchoolById(string schoolId)
   {
            return db._ASI_Schools.SingleOrDefault(x => x.SchoolId == schoolId);
   }


try putting this above your SchoolDetails ActionResult

[OutputCache( Duration=0)]

MVC does some really nice server side caching as well that clearing the cache on the browser does not fix.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜