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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:39:10+00:00 2026-05-31T23:39:10+00:00

I have a custom usercontrol, which is basically a dropdownlist, prepopulated with values from

  • 0

I have a custom usercontrol, which is basically a dropdownlist, prepopulated with values from the database.

<asp:DropDownList ID="selResponseTimes" runat="server" SkinID="filterSkin">                
</asp:DropDownList>

Code behind:

public partial class Response_Times_Drop_Down : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataTable objDataTable = DAL.ExecuteDataTable("sp_cl_Response_Times_Get", null);
            selResponseTimes.DataSource = objDataTable;
            selResponseTimes.DataTextField = "TM_Code";
            selResponseTimes.DataValueField = "TM_Code";
            selResponseTimes.DataBind();
        }
    }

    public string SelectedValue
    {
        get
        {
            return selResponseTimes.SelectedValue;
        }
        set
        {
            selResponseTimes.SelectedValue = value;
        }
    }

}

The control is added to my page as follows, and works fine:

<asp:ResponseTimesDropDown runat="server" ID="selResponse" />

I’m adding client side events as attributes to standard controls on Page_Load using the following:

txtCallRelatedCall.Attributes.Add("onblur", "CheckRelatedCall()");

However, when I attempt to do this with my custom control they are not being added.

selResponse.Attributes.Add("onchange", "CalculateResponseTime()");

However if I debug the code, the attributes are being added to the collection, it appears that they are just not being output to the page. Why is this?

  • 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-31T23:39:11+00:00Added an answer on May 31, 2026 at 11:39 pm

    In what stage of the page lifecycle are you adding the attributes?

    Try adding them in on Page_Init

    Protected void Page_Init(object sender, EventArgs e)
    {
        selResponse.Attributes.Add("onchange", "CalculateResponseTime()");
    }
    

    EDIT (See Comments):

    Public void CalculateResponseEnabled()
    {
            selResponseTimes.Attributes.Add("onchange", "CalculateResponseTime()");
    }
    

    Then in the from you can call CalculateResponseEnabled by doing.

    selResponse.CalculateResponseEnabled();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom UserControl which has a DependencyProperty ItemTemplate of type DataTemplate. I
I have a custom control that inherits from UserControl , and I can't get
How to Bring (form_x) to the front. I have a custom usercontrol which opens
I have a custom WPF control which consist of single TextBox <UserControl HorizontalAlignment=Left x:Class=WPFDiagramDesignerControl.Components.UcWBSBlock
I have a custom UserControl which contains several TextBoxes with Validators. One TextBox with
I have a custom UserControl which tries to recreate auto-complete for a textbox. When
I have a custom UserControl with an image and a label, both of which
I have made one custom user control (search text box), which basically consists of
I have a custom DepenencyProperty which determines a UserControl's visibility. It is usually bound
I have a custom control of class DottedCanvas inherited from Canvas, which contains some

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.