Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4259042
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:43:50+00:00 2026-05-21T05:43:50+00:00

Hy. I know that there are no server controls and server-side events, but…: My

  • 0

Hy.

I know that there are no server controls and server-side events, but…:

My app is like an email box and the unread items are bold displayed.
enter image description here

Ok… the bold items are the unread (isRead==false). I want to update the item to (isRead=true) without any click.. just before the page is rendered.

How should I do it? Is there a way in ASP.NET MVC or will I have to do it with JQuery?

.

What is the best way to call a method AFTER “View” rendered?

.

Tks, guys!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T05:43:50+00:00Added an answer on May 21, 2026 at 5:43 am

    Generally once your action has done it’s thing, and you’ve made it to the view, there’s no going back to code (so to speak). There are two ways to approach this problem.

    1. You create a copy of the list of messages to pass to the view and change the original to have isRead=true. I would say this is the preferred way of solving your problem and the code will look something along the lines of:

      var viewMessages = from m in messages  
                         select new Message  
                         {  
                              // Fields you want to copy go here   
                         }
      
      viewMessages.ToList(); //This actually creates a list from the query
      
      // update the isRead property
      foreach( var m in messages ){
           m.isRead = true;
      }
      

      You now have two collections, a copy of the original data you can pass to the view to render the data correctly, and the other is your original collection with all items updated with isRead = true.

    2. The other option isn’t as good from the design point of view, but it will be able to accomplish the same goal. You can put the code to update the property directly into the view, right below where you do the check if it’s read or not to change the bold. I’m assuming your view looks something along the lines of:

      @foreach(var message in View.Messages) {
         // some code
         <td @(message.isRead ? " class=\"selected\"" : null)
             message.Heading
             @{ message.isRead = true; } // Set it as read once it's been rendered
         </td>
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that there can be multiple values for an email, but I'm not
I know that there are lots of examples out there on this, but they
I know that there are many Delphi database related questions available, but I'm considering
i know that there is some rules and standards in css handling but i
I know that you can cache the WSDL but is there a way to
I am building a scalable Server Side App in Java but I need to
Are there any asp.net server controls that only work with Internet Explorer. I am
I know the use of server-side controls is a no-no in ASP.NET MVC, however
i want to know is there any difference between server controls and HTML controls
hi all as i know that asp.net provide server side validation control which has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.