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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:23:56+00:00 2026-05-17T17:23:56+00:00

I have an ASCX that contains <my:Foo ID=Bar runat=server Value=” /> I want to

  • 0

I have an ASCX that contains

<my:Foo ID="Bar" runat="server" Value='' />

I want to set Value with textbox1.Text, but Value is an Int32. I am looking for something like this:

<my:Foo ID="Bar" runat="server" Value='<%= Int32.Parse(textbox1.Text) %>' />

But I get

Parser Error Message: Cannot create an object of type 'System.Int32' from its string representation '<%= Int32.Parse(textbox1.Text) %>' for the 'Value' property.

Is there a way to do this on the ASCX file? Do I have to implement a TypeConverter for this property?

  • 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-17T17:23:57+00:00Added an answer on May 17, 2026 at 5:23 pm

    I don’t understand why you can’t simply use the literal instead of a string representation:

    <my:Foo ID="Bar" runat="server" Value="58" />
    

    If you want to set this value dynamically, you will need to do so in the code behind or within a code block, for example in the page load event handle, as you cannot use code blocks (<%%>) within a server side control:

    // code behind, in the page_load event handler
    Bar.Value = 58;
    

    Or, within the ascx, outside of server side controls:

    <% Bar.Value = 58; %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UserControl that contains a CheckBox and a TextBox: <asp:CheckBox runat=server ID=chk1
For example, i have this ImageViewer.ascx UserControl: <div class=ImageTumbnails> <asp:ListView ID=ImageList runat=server ItemPlaceholderID=ItemContainer> <LayoutTemplate>
I have ASCX control, that basically contains just a DIV with few ASP buttons
I have a custom user control (ascx) that contains a textbox and a Javascript-based
I have an ascx that uses Eval in a repeater like this: <%@ Control
I have an .ascx control inside la page. In that control, I have a
I have a .aspx page that loads three separate .ascx controls to represent adding,
I have an ASP.NET user control (.ascx file). In this user control I want
i have 2 textbox controls inside a usercontrol TextBoxUC.ascx i have a page.aspx that
I have a page that contains a user control. Can i make an ajax

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.