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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:17:48+00:00 2026-06-12T10:17:48+00:00

I have a variable in a code behind control. I want to pass this

  • 0

I have a variable in a code behind control. I want to pass this value to an Ext.Net control in the web control. In my instance I have an ext.multicombo, and I want to pass a value to it’s Tooltip.

Code Behind:

protected override void OnPreRender(EventArgs e)
{
this.MaxFuelFilter = System.Configuration.ConfigurationManager.AppSettings["MyVariable"]; 
}

Control.aspx

<ext:multicombo ID="ddlFlightNumber" runat="server" ClientID="ddlFlightNumber" IndicatorTip="blah blah blah  <%=MyVariable%> blah blah blah"></ext:multicombo>

How do I do something like this?

Thanks

  • 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-06-12T10:17:49+00:00Added an answer on June 12, 2026 at 10:17 am

    There are a few issues:

    The syntax you’re using will not work with ASP.NET Controls. This is an ASP.NET limitation, and not related to Ext.NET.

    This is not valid ASP.NET syntax:

    PropertyName="foo foo <%=MyVariable%>"
    

    And, this is not valid ASP.NET syntax:

    PropertyName="<%=MyVariable%>"
    

    To pass a value into the property, you’ll need to use the <%# %> DataBinding syntax.

    Although, this is also not valid ASP.NET syntax:

    PropertyName="foo foo <%# MyVariable %>"
    

    The property must ONLY contain the databind variable/script, example

    PropertyName="<%# MyVariable%>"
    

    AND… you must call .DataBind() on the Control, example

    this.MyControl1.DataBind();
    

    OR, with Ext.NET Controls, you can set the .AutoDataBind="true" property and DataBinding will be automatically handled for you, example

    <ext:TextField runat="server" PropertyName="<%# MyVariable%>" AutoDataBind="true" />
    

    The above custom property is auto-serialized into JavaScript and is now available to the client-side instance of that control (and others). You can then call that property from other JavaScript code.

    For your scenario, I’d recommend tapping into an <AfterRender> Listener of the <ext:MultiCombo> to get the property value and set something else. The following sample demonstrates the complete scenario (myVar), and also demonstrates another basic technique (myVar2) for passing a JavaScript variable into the client-side from the server-side.

    Example

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <script runat="server">
        string myVar;
        string myVar2;
    
        protected void Page_Load(object sender, EventArgs e)
        {
            myVar = "Label 1";
            myVar2 = "Label 2";
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:TextField 
                ID="TextField1" 
                runat="server" 
                MyVar="<%# myVar %>"
                AutoDataBind="true" 
                FieldLabel="Testing">
                <Listeners>
                    <AfterRender Handler="this.setFieldLabel(this.myVar);" />
                </Listeners>
            </ext:TextField>
    
            <ext:TextField 
                ID="TextField2" 
                runat="server" 
                MyVar="<%# myVar2 %>"
                AutoDataBind="true" 
                FieldLabel="Testing">
                <Listeners>
                    <AfterRender Handler="this.setFieldLabel(myVar2);" />
                </Listeners>
            </ext:TextField>
    
            <script type="text/javascript">
                var myVar2 = "<%= myVar2 %>";
            </script>
        </form>
    </body>
    </html>
    

    You should be able to adapt the above to work with your custom Control.

    Hope this helps.

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

Sidebar

Related Questions

A doubt in ASP.NET(VB) I have a public variable in code-behind(ASPX.VB) Public _orderCode As
I have this code right here, where the $friends variable is an array with
We currently have a WebForms control with an update panel. The code-behind contains logic
I have a small-scale WPF application using VB.net as the code behind and I
I have to bind to local variable from code behind in ListView.ItemTemplate. I have
Hi i have a variable which i am setting in the code behind which
I am running an asp.net code-behind that creates a string variable which holds a
I have a list box control: <asp:ListBox runat=server id=lbox autoPostBack=true /> The code behind
I have a variable () loaded with a html code: $.get(url, function (res, data)
I have the following code to set a userId variable: (userId set in prior

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.