asp.net mvc - after render Event on MVC. Possible? -
hy.
i know there no server controls , server-side events, but...:
my app email box , unread items bold displayed. 
ok... bold items unread (isread==false). want update item (isread=true) without click.. before page rendered.
how should it? there way in asp.net mvc or have jquery?
.
what best way call method after "view" rendered?
.
tks, guys!
generally once action has done it's thing, , you've made view, there's no going code (so speak). there 2 ways approach problem.
you create copy of list of messages pass view , change original have
isread=true. preferred way of solving problem , code along lines of:var viewmessages = m in messages select new message { // fields want copy go here } viewmessages.tolist(); //this creates list query // update isread property foreach( var m in messages ){ m.isread = true; }you have 2 collections, copy of original data can pass view render data correctly, , other original collection items updated
isread = true.the other option isn't design point of view, able accomplish same goal. can put code update property directly view, right below check if it's read or not change bold. i'm assuming view looks along lines of:
@foreach(var message in view.messages) { // code <td @(message.isread ? " class=\"selected\"" : null) message.heading @{ message.isread = true; } // set read once it's been rendered </td> }
Comments
Post a Comment