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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:29:49+00:00 2026-05-14T03:29:49+00:00

I have the following code: <%@ Control Language=C# AutoEventWireup=true CodeBehind=DurationPicker.ascx.cs Inherits=Permias.DurationPicker %> <%@ Register

  • 0

I have the following code:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DurationPicker.ascx.cs" Inherits="Permias.DurationPicker" %>
<%@ Register TagPrefix="Club" Namespace="ClubSite" %>
<div class="controlblock">
    <table>
        <tr>
            <td>
                Start Date:
            </td>
            <td>
                <Club:DatePicker ID="dp1" runat="server" />
            </td>
            <td>
                <Club:TimePicker ID="tp1" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                End Date:
            </td>
            <td>
                <Club:DatePicker ID="dp2" runat="server" />
            </td>
            <td>
                <Club:TimePicker ID="tp2" runat="server" />
            </td>
        </tr>
    </table>
</div>

In my code behind I have

public System.DateTime startDateTime
    {
        get
        {
            return dp1.SelectedDate.Add(tp1.SelectedTime.TimeOfDay);
        }
        set
        {
            dp1.SelectedDate = value;
            tp1.SelectedTime = value;
        }
    }

However dp1 is underlined in red, which means it can’t find dp1.. 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-14T03:29:50+00:00Added an answer on May 14, 2026 at 3:29 am

    none of these seems to resolve my issue….

    in my solution I have a App_Code folder and inside that I have DataPicker.cs which is under the namespace ClubSite

    namespace ClubSite
    {
        public static class commonScript
        {
    
            public static void WritePopupRoutines(System.Web.UI.Page Page)
            {
                StringBuilder sb = new StringBuilder();
                sb = new StringBuilder();
                sb.AppendLine("var __popup_panel;");
    
                sb.AppendLine("function __popup_clear() {");
                sb.AppendLine(" if (__popup_panel != null ) ");
                sb.AppendLine(" {");
                sb.AppendLine(" document.getElementById(__popup_panel).style.display='none';");
                sb.AppendLine(" __popup_panel=null;");
                sb.AppendLine(" }");
                sb.AppendLine("}");
                sb.AppendLine("function __popup_losefocus(panel)");
                sb.AppendLine("{");
                sb.AppendLine(" if (!panel.contains(document.activeElement))");
                sb.AppendLine(" {");
                sb.AppendLine(" panel.style.display='none';");
                sb.AppendLine(" }");
                sb.AppendLine("}");
    
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "PopupRoutines", sb.ToString(), true);
            }
        }
    
        public class DatePicker : WebControl, INamingContainer
        {
            private Calendar _innerCal;
            private TextBox _innerTbx;
            private string errorText = null;
            private bool _panelvisible = false;
    
            public DatePicker() : base(HtmlTextWriterTag.Div)
            {
    
            }
    
            public System.DateTime SelectedDate
            {
                get
                {
                    EnsureChildControls();
                    System.DateTime d=System.DateTime.Now;
                    try
                    {
                        d = System.DateTime.Parse(_innerTbx.Text);
                        errorText = null;
                        _innerCal.SelectedDate = d;
                    }
                    catch
                    {
                        errorText = "Date needs to be specified as mm/dd/yyyy";
                    }
                    return d;
                }
                set
                {
                    EnsureChildControls();
                    _innerCal.SelectedDate = value;
                    _innerTbx.Text = value.ToShortDateString();
                }
            }
    
            protected override void CreateChildControls()
            {
                base.CreateChildControls();
                _innerTbx = new TextBox();
                this.Controls.Add(_innerTbx);
    
                _innerCal = new Calendar();
                _innerCal.SelectionChanged += new System.EventHandler(_innerCal_SelectionChanged);
                _innerCal.VisibleMonthChanged += new MonthChangedEventHandler(_innerCal_MonthChanged);
                Controls.Add(_innerCal);
            }
    
            protected override System.Web.UI.HtmlTextWriterTag TagKey
            {
                get
                {
                    return HtmlTextWriterTag.Div;
                }
            }
    
            protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
            {
                if (this.Width.IsEmpty)
                {
                    this.Width = new Unit(150);
                }
                base.AddAttributesToRender(writer);
            }
    
            protected override void RenderContents(System.Web.UI.HtmlTextWriter writer)
            {
                _innerTbx.Attributes.Add("Align", "AbsMiddle");
                _innerTbx.Width = new Unit(100);
                _innerTbx.RenderControl(writer);
    
                string innerid = this.UniqueID + "_inner";
    
                writer.AddAttribute("Align", "AbsMiddle");
                writer.AddAttribute("src", "images/dropdownbtn.gif");
                writer.AddAttribute("onClick", "__datepicker_showpopup('" + innerid + "')");
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag();
    
                if (errorText != null)
                {
                    writer.AddStyleAttribute("color", "red");
                    writer.AddStyleAttribute("display", "block");
                    writer.RenderBeginTag(HtmlTextWriterTag.Span);
                    writer.Write(errorText);
                    writer.RenderEndTag();
                }
    
                writer.AddStyleAttribute("position", "relative");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
    
                writer.AddStyleAttribute("position", "absolute");
                writer.AddStyleAttribute("left", "0px");
                writer.AddStyleAttribute("top", "0px");
                writer.AddStyleAttribute("z-index", "100");
    
                string panelvisible = _panelvisible ? "block" : panelvisible = "none";
    
                writer.AddStyleAttribute("display", panelvisible);
                writer.AddStyleAttribute("background-color", "white");
                writer.AddAttribute("id", innerid);
                writer.AddAttribute("onfocusout", "__popup_losefocus(this)");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
    
                _innerCal.RenderControl(writer);
    
                writer.RenderEndTag();
                writer.RenderEndTag();
            }
    
            protected override void OnPreRender(System.EventArgs e)
            {
                base.OnPreRender(e);
                commonScript.WritePopupRoutines(Page);
                StringBuilder sb = new StringBuilder();
                if (_panelvisible)
                {
                    sb.AppendLine("__popup_panel = '" + this.UniqueID + "_inner';");
                }
                sb.AppendLine("function __datepicker_showpopup(name)");
                sb.AppendLine("{");
                sb.AppendLine(" if (__popup_panel != null)");
                sb.AppendLine(" {");
                sb.AppendLine(" document.getElementById(__popup_panel).style.display='none';");
                sb.AppendLine(" }");
                sb.AppendLine(" __popup_panel=name;");
                sb.AppendLine(" var panel=document.getElementById(__popup_panel);");
                sb.AppendLine(" panel.style.display='block';");
                sb.AppendLine(" var links=panel.getElementsByTagName('A');");
                sb.AppendLine(" links[0].focus();");
                sb.AppendLine(" window.event.cancelBubble=true;");
                sb.AppendLine("}");
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "popup", sb.ToString(), true);
                Page.MaintainScrollPositionOnPostBack = true;
            }
    
            private void _innerCal_SelectionChanged(object sender, System.EventArgs e)
            {
                EnsureChildControls();
                _innerTbx.Text = _innerCal.SelectedDate.ToShortDateString();
            }
    
            private void _innerCal_MonthChanged(object sender, MonthChangedEventArgs e)
            {
                _panelvisible = true;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.