473,508 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting controls values


Hi,

I am developing a JavaScript calendar control. I want my user control to
expose a property that returns the value of the selected calendar date. I
have an "input" control that displays the selected date. I also tried to add
a Label server-side control, but I am unable to set its value through
Javascript.

<form id="mainForm" name="mainForm" action="" method="post">
<p>
<input id="fullDate" type="text" disabled maxLength="9" size="9"
name="fullDate">
<input id="showit" onclick="showCalendar(event)" type="button">
</p>
<asp:Label id="Label1" runat="server" Visible="false">Label</asp:Label>
</form>

function chooseDate(day, month, year) {
document.getElementById("fullDate").innerText = day + "/" + month + "/" +
year;
document.getElementById("Label1").innerText = day + "/" + month + "/" +
year; //fails
hide("calendar");
}

Is there a solution to this?

Thanks
Mike
Nov 18 '05 #1
1 1361
Hi, Mike,

Setting the property Visible to false prevents the control from being
rendered to the page output (that's the case with Label1).

I'd change the <input type=text"> with an <asp:textbox runat="server"
readonly="true"/> and read the value on the postback.

Hope this helps
Martin
"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:78**********************************@microsof t.com...

Hi,

I am developing a JavaScript calendar control. I want my user control to
expose a property that returns the value of the selected calendar date. I
have an "input" control that displays the selected date. I also tried to add a Label server-side control, but I am unable to set its value through
Javascript.

<form id="mainForm" name="mainForm" action="" method="post">
<p>
<input id="fullDate" type="text" disabled maxLength="9" size="9"
name="fullDate">
<input id="showit" onclick="showCalendar(event)" type="button">
</p>
<asp:Label id="Label1" runat="server" Visible="false">Label</asp:Label>
</form>

function chooseDate(day, month, year) {
document.getElementById("fullDate").innerText = day + "/" + month + "/" +
year;
document.getElementById("Label1").innerText = day + "/" + month + "/" +
year; //fails
hide("calendar");
}

Is there a solution to this?

Thanks
Mike

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1779
by: Gary Hasler | last post by:
I have a full page of thumbnails linked to home plan pages. I'm adding a mouseover/mouseout effect to the table cells, plus a onclick event to permanently set the cell background to indicate the...
2
3732
by: John Hargrove | last post by:
I'm having trouble setting decimal place values in the results field of a sample management database I'm building for an environmental testing laboratory. The degree of sensitivity varies among...
7
20751
by: charliewest | last post by:
Using .Net CF, i have created a 2 dimension ArrayList, and "binded" this list to a ComboBox control using the "DataSource" property. I have set the DisplaySource and ValueMember properties as well....
0
894
by: Ash | last post by:
I want to provide the ability for my users to login from any page that they are on. ie. have a login user control with a username and password box on each page (not a link to a login page). ...
9
2329
by: james.e.coleman | last post by:
Hello, I have created a custom dropdownlist that is used multiple times within a single page. When trying to set the values of the controls with the page in which they are being used, they all...
3
1929
by: Patrick | last post by:
I am dynamically creating TextArea and drop-down lists in ASP.NET using something like HtmlTextArea eachTextArea = new HtmlTextArea(); I tried to set the "name" of these TextAreas, etc. (e.g....
3
3899
by: Mark Rae | last post by:
Hi, Just a general quickie on setting properties of user controls from the parent form. Let's say I have a user control called note.ascx which displays a datagrid. That datagrid is populated...
1
6441
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
6
11058
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
6
10098
by: alun65 | last post by:
I'm having trouble programmatically adding a user control and then setting some of it's server controls. I add the user control to the code behind and add it to a placeholder: protected void...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7405
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.