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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:59:35+00:00 2026-05-13T00:59:35+00:00

I have an usercontrol with an attribute targetUrl. I add this user control to

  • 0

I have an usercontrol with an attribute targetUrl. I add this user control to a page and write targetUrl attribute from this page like below:

<PBG:Modal ID="Modal1"
           runat="server"
           Height="180"
           Width="500"
           src="pop_adres_giris.aspx"/>

This worked properly, but I want to change the targetUrl attribute from javascript. And I can’t do it. I write code like below, but it didn’t work.

var frm = document.getElementById('Modal1');            
frm.targetUrl = 'pop_adres_giris.aspx';

How can I do it?

  • 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-13T00:59:35+00:00Added an answer on May 13, 2026 at 12:59 am

    The UserControl object, which generates HTML on the client side, are not accessible as the rich objects which are available when handling server side calls.

    Depending what the UserControl is, you will need to use a different method to get it and set the “targetUrl”.

    In addition, to ease your accessing of elements within the DOM you may want to consider using a library such as jQuery or prototype

    Once you have declared your control, for instance, if you were using an asp:Hyperlink control:

    <div id="hyperlink_holder">
      <asp:Hyperlink ... NavigateUrl="http://someurl" />
    </div>
    

    You know that asp:Hyperlink generates html like <a href="http://someurl" ... />

    So we can access the element and change the link like:

    $('#hyperlink_holder a').attr("href", "http://newurl");
    

    In addition, note that the ID you give an item in ASP.NET is not necessarily the ID which will render in the id element in the HTML; it is instead a concatenation of a number of ids; therefore use selectors based on non runat=”server” controls where possible, or pass the ClientID of the UserControl through to the client to use for selection if absolutely necessary.

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

Sidebar

Related Questions

I have a ASP.NET user control which hosts a 'HtmlImage'. The src attribute is
I have UserControl which contains a TextBox and a Button control. The Button opens
I have a UserControl called CustomerFinder for searhing customers. And there is "ADD" button
So I have a UserControl with some cascading DropDownList s on it. Selecting from
I have a usercontrol that has several public properties. These properties automatically show up
I have a UserControl that consists of three TextBoxes. On a form I can
I have a UserControl in my Asp.net project that has a public property. I
I have a UserControl with some predefined controls (groupbox,button,datagridview) on it, these controls are
I have a usercontrol that is meant to take up the entire form. I
If I have a usercontrol (in Silverlight) that I've written, that uses XAML to

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.