Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 19th, 2004, 09:55 AM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with DataGrid & JavaScript

Hi,

I am using a datagrid web control to display some data. One of the columns in this datagrid has text boxes which displays data and the user can change the data listed here. I also have a checkbox outside the datagrid which when checked, the textboxes in that particular column are disabled. I am using javascript to accomplish this. (document.getElementById("TextBox1").disabled = true;)

Now consider this scenario: Let's say that the data displayed in the first textbox of that particular column is '1'(on page load). If the user changes this to '2' and checks the checkbox that disables the textbox displaying this data and then clicks the submit button, I want to display '2' in that textbox after postback. To do this Iam trying to read this value from the webpage using the code shown below. But when the textboxes in that column of the datagrid have been disabled by javascript, this particular snippet of code that I am using to get the value in that textbox returns a null value. (This doesn't happen with any text box outside the datagrid. Neither does it happen when the text boxes in that column of datagrid are enabled).

Is there a way to work around this or is there any other solution to this problem?

Code:

    foreach (DataGridItem DG_Item in DataGrid1)
    {
        text1 = ((TextBox)DG_item.FindControl("TextBox1")).Text;
    }

Thanks in advance,
Qadeer.

Reply With Quote
  #2 (permalink)  
Old April 19th, 2004, 10:22 AM
Imar's Avatar
Wrox Author
Points: 66,815, Level: 100
Points: 66,815, Level: 100 Points: 66,815, Level: 100 Points: 66,815, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,157
Thanks: 65
Thanked 1,393 Times in 1,373 Posts
Default

Hi there,

I think you're better off asking these kind of .NET questions in an ASP.NET forum. This for is for classic ASP, not ASP.NET.

Anyway, I think that disabled controls do not participate in postback. That is, the browser doesn't add them to the form collection when it submits the page. You can set the textbox to ReadOnly instead. This will prohibit the user from changing the value, while the field will still be submitted.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Loose Joints by This Mortal Coil (Track 5 from the album: Blood)

Reply With Quote
  #3 (permalink)  
Old April 19th, 2004, 10:28 AM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks again Imar.. I didn't realize that this forum was for classic ASP...

Qadeer

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript & XML & NN lmod Javascript How-To 0 August 18th, 2005 03:16 PM
Javascript && keeps turnig into && ayrton Pro VB.NET 2002/2003 3 June 27th, 2005 03:34 PM
Tricky Javascript/XSL '&' problem...... robster Javascript How-To 1 January 23rd, 2004 01:11 PM
xml & javascript shine Javascript How-To 0 December 24th, 2003 06:25 AM
Treeview & Javascript menu problem lbob Classic ASP Professional 0 September 17th, 2003 10:17 AM



All times are GMT -4. The time now is 02:29 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.