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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:21:23+00:00 2026-05-23T21:21:23+00:00

I have a user control named lets say ucName that has a property named

  • 0

I have a user control named lets say ucName that has a property named InitialValue.
Everything’s fine , Im rendering the control and setting the initial value.
In my aspx page, Im doing like this:

<td>                
    <tagprefixName:ucName ID="Editor" runat="server"   InitialValue="bla bla"/>
</td>

I have a button that will post back the page, but before post backing, im doing:

<asp:Button  ID="SaveButton" runat="server" Text="Save" OnClick="SaveRes" OnClientClick="SaveValue()" />.

In javascript function I want to get the value of the initial value of my user control:
I tried many solutions, but they are either returning null or undefined.

function SaveValue() {
            var v= $("[id$=Editor]").attr("InitialValue");
            var v = $("#Editor").attr("InitialValue"); 
            var v= $("input[id$=Editor]").attr("InitialValue");
            var v= $("span[id$=Editor]").attr("InitialValue");//since the uc is rendered as span
}

How can I get the InitalValue of my uc ??
Thanks alot

EDIT
This is my html:

<span id="ctl00_PlaceHolderMain_Editor"><input name="ctl00$PlaceHolderMain$2f1445d6-b13d-4f8f-9497-9c14e5d2b076" type="text" value="fgerf" id="ctl00_PlaceHolderMain_2f1445d6-b13d-4f8f-9497-9c14e5d2b076" /></span>

NB: I tried using .val() .value() but still getting an empty

  • 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-23T21:21:24+00:00Added an answer on May 23, 2026 at 9:21 pm

    The uc is rendered as an input inside a span has the uc’s id, so the javascript code will be:

    $("span[id$=Editor] input[type=text]").val();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UserControl (lets say Foo.ascx) that has a Type public property with
I have user control named DateTimeUC which has two textboxes on its markup: <asp:TextBox
I have a user control in a repeater that I need to pass data
I have a user control that is pretty basic. It contains several TextBox controls,
I have a user control that I'm building. It's purpose is to display the
Is there way to associate a javascript function to a user control? Lets say
I have a user control that inherits from the ListBox class and displays a
Lets say i have an html control of the form <input name='options' value='one' title='ABC'>
I have a User Control, let's say TextboxPage and it's associated with ViewModel, TextboxPageViewModel.
I've got a user control which lets users provided their own script names that

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.