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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:27:49+00:00 2026-05-25T17:27:49+00:00

I want to call MyMethod in code-behind from server control in aspx page like

  • 0

I want to call MyMethod in code-behind from server control in aspx page like below.

MyPage.aspx

<asp:Label ID="MyLabel" runat="server" Text='<%# MyMethod(Eval("MyColumn")) %>'>

MyPage.aspx.cs

protected void MyMethod(object obj) { ... }

If I use " instead ' in aspx page then it will give me a compilation error The server tag is not well formed. as below.

<asp:Label ID="MyLabel" runat="server" Text='<%# MyMethod(Eval("MyColumn")) %>'> // This line work
<asp:Label ID="MyLabel" runat="server" Text="<%# MyMethod(Eval("MyColumn")) %>"> // This line error

I want to know why I need to use single-quote, is it a rule? How can I use double-quote in my situation?

  • 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-25T17:27:50+00:00Added an answer on May 25, 2026 at 5:27 pm

    I want to know why I need to use single-quote, is it a rule? How can I
    use double-quote in my situation?

    The use of Single quote over Double quote is just to make it clear where the string is ending. You cannot use Text=”MyMethod(“123″)” because the Text start with the M and may end with the ( or the 3 or the last ). By using single and double quote the compiler know when the string end.

    Text="MyMethod('123')"
    
    Text='MyMethod("123")'
    

    Your example is about binding but let say that you would like to have a double quote while using a double quote for a non-binding situation. You could have use the HTML entity "

    Text="This is my string with  &quot; inside &quot;" //This will produce : This is my string with "inside"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to call my .NET code from unmanaged C++. My process entrypoint is
I want to call a function from a .NET DLL (coded in C#) from
I want to call a c# function from my javascript function. I have a
I want to call some RESTful web services from a J2ME client running on
I want to call an ASHX file and pass some query string variables from
When my JavaScript code uses AJAX to call an ASP.NET MVC method, it passes
I have a method public void MyMethod(decimal val) { } I want to call
i am trying to make AJAX Call to ASP.Net Server Side Web service method
I want to call a web service, but I won't know the url till
I want to call a few static methods of a CPP class defined in

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.