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 6142903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:27:02+00:00 2026-05-23T18:27:02+00:00

The following code: aspx file: <div id=challengedIndependence class=collegeAccentBlock grid_8 push_1 runat=server clientidmode=Static style=’display:<%# testMethod

  • 0

The following code:

aspx file:

<div id="challengedIndependence" class="collegeAccentBlock grid_8 push_1" runat="server" clientidmode="Static" style='display:<%# testMethod %>' >

associated aspx.cs file:

  public string testMethod()
    {
        return "none;";
    }

rendered html file:

<div id="challengedIndependence" class="collegeAccentBlock grid_8 push_1" style="display:&lt;%# testMethod %&gt;">
</div>

I am expecting the result to rendder as …style:”display:none;”… what am I doing wrong.

Not sure if this should be in the same question: I am doing this because I have multiple lines of code to determine whether this div should be displayed. If there is another way of doing this and an explanation as to why it is better I would also accept that answer.

Reference: Inline expressions referenced on MSDN

  • 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-23T18:27:03+00:00Added an answer on May 23, 2026 at 6:27 pm

    If you’re going to use an inline expression here, it needs to be the entire content of that attribute, like this:

    <div id="challengedIndependence" class="collegeAccentBlock grid_8 push_1" runat="server" clientidmode="Static" style='<%# testMethod() %>' >
    

    and then return the entire string you want there. It’s just rendering it as part of the string.

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

Sidebar

Related Questions

I have the following code within my .aspx file <ext:GridPanel runat=server ID=GridPanel1 Height=450 Title=EmployeeList
Inside my aspx file, I have the following html code inside an repeater: <div
I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I am using the following code to store values in aspx session. Code: $(div.menu_body
I've put the following code in global.asax <%@ Application Language=VB %> <script runat=server> Sub
I've got the following code in my aspx file: <% using (Html.BeginForm()) { int
Morning stackoverflow, I have a repeater, with the following code in my aspx page;
I'm working at the aspx page, and the following code is inserted in a
I've got the following piece of code in an aspx webpage: Response.Redirect(/Someurl/); I also
In my Default.aspx web page i use the following code in order to save

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.