Avatar of foleyp2007
foleyp2007 asked on

Creating a Read-Only Editable TextBox

Hi,
As you can see below I have a text box and a popup calendar. Is there a way to make the TextBox ReadOnly or Enabled=False so only the popup calendar can edit the textbox. I only want the user to be able to change the date via the popup control, but if it is ReadOnly or Disabled, it shows the new values but it dosen't hold them as the value.


<%@ Control Language="C#" AutoEventWireup="true" Inherits="PaymentsLog.Web.Controls.DatePicker"
    Codebehind="DatePicker.ascx.cs" %>
<span style="white-space: nowrap;">
    
<asp:TextBox ID="txtDate" runat="server" Columns="10"></asp:TextBox>
    <asp:ImageButton ID="imgButton" OnClientClick="return false;" runat="server" ImageUrl="~/App_Themes/Default/img/calendar.jpg" />
    
<act:CalendarExtender ID="calExt" runat="server" FirstDayOfWeek="Monday" PopupButtonID="imgButton"
        TargetControlID="txtDate" Format="yyyy/MM/dd" Animated="False">
    </act:CalendarExtender>
</span>

Open in new window

ASP.NET

Avatar of undefined
Last Comment
third

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
third

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
foleyp2007

Thanks, this worked, but I'm not exactly sure why?
ASKER
foleyp2007

Hi,
This solution worked although I'm not entirely sure why?

Paul.
third

the statement I posted above will add the readonly attribute on the html tag. The readonly or enabled property from your control is for server-side processing.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER
foleyp2007

Ok,

I understand it fully now. Thanks for your help on this,

Regards,
Paul.
third

welcome. :-)