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

  • SEARCH
  • Home
  • 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 6471911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:16:48+00:00 2026-05-25T06:16:48+00:00

When I am databinding an entire page, I will do something like this: Blah

  • 0

When I am databinding an entire page, I will do something like this:

Blah blah…

<%# SomeProperty == "GoodBye" ? "See you later" : "Hello" %>

And that works beatifully. However, often I will not use databinding for an entire page and write things the “clasic” ASP.NET way. E.g., in the code behind I will have something like:

lblSomeMessage.Text = SomeProperty == "GoodBye" ? "See you later" : "Hello";

And then .aspx would have

<asp:label runat="server" id="lblSomeMessage"/>

But what I want to do both…sort of. What I would like to do is not use databinding syntax but instead a code block:

<%= SomeProperty == "GoodBye" ? "See you later" : "Hello" %>
^^^^

Noe the output tag syntax. Now, the question is, when will this tag actually be evaluated? Suppose I don’t set the SomeProperty property until the OnPreRender event. Is that too late? In my testing I actually did this:

<%= SomeProperty == "GoodBye" ? + new System.Diagnostics.StackTrace().ToString() : "OH NO!" %>

And according to the stacktrace:

ASP.webform1_aspx.__Renderform1(HtmlTextWriter __w, Control
parameterContainer) at
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) at
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter
writer)…

It happens during render, which is perfect. But is this guaranteed? Any gotchas to this rule?

  • 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-25T06:16:48+00:00Added an answer on May 25, 2026 at 6:16 am

    Yes, it’s guaranteed to be Render.

    “An embedded code block is server code that executes during the page’s render phase.” – http://msdn.microsoft.com/en-us/library/ms178135.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGridView that uses databinding, with manually created columns, and this works
I have a databinding like this: numericUpDown1.DataBindings.Add(Value, myBox1, Width); Whenever myBox1.Width changes it will
Let's say I am using databinding like this: List<Entity> Entities = <some data> entityBinding.DataSource
I have this databinding that doesn't work and I can not figure ut why.
I'm experimenting with databinding in WPF I have this datagrid that is bound to
I am using databinding and IDataErrorInfo style validation in a form. This form includes
I would like to use databinding when displaying data in a TextBox. I'm basically
Why DataBinding is not working? <TextBox Text={Binding Path=local:MainWindow.SearchPlayer, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged} /> this is my class:
I have a databinding problem in WPF. I would like to customise a slider
I'm new to DataBinding but would like to accomplish the following: I have a

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.