Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 4th, 2004, 01:10 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default Disabled textbox

Hi Experts,

In my aspx page, I have a textbox which is diabled. I am assigning value to this texbox through a client side script (works like a date picker control.). However, I am not able to access this value from the server side. There it always returns an empty string ("").

I get the correct value when i change the Enabled Property of the textbox to true. Only when it is false it returns "".


Have any one of you faced such a problem?? is there any solution to this problem??



Regards
Ganesh
__________________
Regards
Ganesh
http://ganeshprof.blogspot.com
Find your solution here...
 
Old October 4th, 2004, 01:54 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Can u send its code here ?
But before this please check that on both sides u must use same name.



(*_*)

Numan
--------------------------------------------------
It is not important what you get But important is how you got it
 
Old October 4th, 2004, 03:57 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Thanks Numan,

I have a textbox in my form and also a button

<asp:TextBox id="txtJS" runat="server" Enabled="False"></asp:TextBox>
<INPUT type="button" onclick="TestJS()" value="JS">

I am using the following script to populate the textbox from the client side.

function TestJS()
{
    document.getElementById("txtJS") = "Hello World";
}

During the postback I am trying to retrieve the value of the textbox

     string x = txtJS.Text;

now the variable x returns ""

Thanks again

Regards
Ganesh
 
Old October 4th, 2004, 11:53 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The problem is:
A textbox posts it value when you submit the form. When the textbox is disabled, the value is not posted, therefore, no value is carried over in a postback.

Solution:
Perhaps a better option is to make the textbox readonly. This will not disable it but will not permit the user from editing it.
 
Old October 4th, 2004, 11:14 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Thanx a Million

Regards
Ganesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabled Toolbar Options Neal Excel VBA 1 September 7th, 2007 06:19 AM
'disabled' image (greyed-out)? crmpicco Javascript How-To 9 October 6th, 2005 03:51 AM
Disabled icons EricJ VB How-To 0 July 12th, 2005 09:51 AM
Watch Window is disabled LaFeverMF ADO.NET 1 July 21st, 2004 11:32 PM
disabled popup renee_santoscoi Javascript How-To 5 November 11th, 2003 02:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.