473,626 Members | 3,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Wierd behavior with text box postback

I'm working for a company in Houston developing a web application. At one
point in the code, we have to refresh the page, but save what checkboxes have
been selected. Since these checkboxes are created programmaticall y according
to configuration files, they cannot be asp checkboxes.

To do this, before refreshing I save which checkboxes are selected to an asp
textbox and perform a postback. Later in the .aspx file, I have a <% %>
block that calls a method from the codebehind to output a Javascript call.
However, in this codebehind C# call, when I access the textbox's .Text field,
it is always empty, regardless of the actual values put in the text box. The
really strange part of it is that when the page refreshes, the asp textbox
has the correct values in the input tag's value attribute.

Is there some wierd execution order to ASP.NET that I am unaware of that
would cause this? And, more importantly, is there a way around it? any help
would be greatly appreciated.
Nov 19 '05 #1
3 2069
Do you have anything in onload event and if so Do you handle IsPostBack?
"Michael Loughry" <Mi************ @discussions.mi crosoft.com> wrote in
message news:31******** *************** ***********@mic rosoft.com...
I'm working for a company in Houston developing a web application. At one
point in the code, we have to refresh the page, but save what checkboxes
have
been selected. Since these checkboxes are created programmaticall y
according
to configuration files, they cannot be asp checkboxes.

To do this, before refreshing I save which checkboxes are selected to an
asp
textbox and perform a postback. Later in the .aspx file, I have a <% %>
block that calls a method from the codebehind to output a Javascript call.
However, in this codebehind C# call, when I access the textbox's .Text
field,
it is always empty, regardless of the actual values put in the text box.
The
really strange part of it is that when the page refreshes, the asp textbox
has the correct values in the input tag's value attribute.

Is there some wierd execution order to ASP.NET that I am unaware of that
would cause this? And, more importantly, is there a way around it? any
help
would be greatly appreciated.

Nov 19 '05 #2
<% %> code blocks run during the page init process. this is before postback
data is loaded into controls. your code behind can fetch the value from the
form variable collection.

note: databinding works by putting the binding expression in the value, then
replacing the expression with the value when databound.

-- bruce (sqlwork.com)

"Michael Loughry" <Mi************ @discussions.mi crosoft.com> wrote in
message news:31******** *************** ***********@mic rosoft.com...
I'm working for a company in Houston developing a web application. At one
point in the code, we have to refresh the page, but save what checkboxes
have
been selected. Since these checkboxes are created programmaticall y
according
to configuration files, they cannot be asp checkboxes.

To do this, before refreshing I save which checkboxes are selected to an
asp
textbox and perform a postback. Later in the .aspx file, I have a <% %>
block that calls a method from the codebehind to output a Javascript call.
However, in this codebehind C# call, when I access the textbox's .Text
field,
it is always empty, regardless of the actual values put in the text box.
The
really strange part of it is that when the page refreshes, the asp textbox
has the correct values in the input tag's value attribute.

Is there some wierd execution order to ASP.NET that I am unaware of that
would cause this? And, more importantly, is there a way around it? any
help
would be greatly appreciated.

Nov 19 '05 #3
I'm not enitrely sure I understand what you mean. What form variable
collection? And how exactly does data binding work?

"Bruce Barker" wrote:
<% %> code blocks run during the page init process. this is before postback
data is loaded into controls. your code behind can fetch the value from the
form variable collection.

note: databinding works by putting the binding expression in the value, then
replacing the expression with the value when databound.

-- bruce (sqlwork.com)

"Michael Loughry" <Mi************ @discussions.mi crosoft.com> wrote in
message news:31******** *************** ***********@mic rosoft.com...
I'm working for a company in Houston developing a web application. At one
point in the code, we have to refresh the page, but save what checkboxes
have
been selected. Since these checkboxes are created programmaticall y
according
to configuration files, they cannot be asp checkboxes.

To do this, before refreshing I save which checkboxes are selected to an
asp
textbox and perform a postback. Later in the .aspx file, I have a <% %>
block that calls a method from the codebehind to output a Javascript call.
However, in this codebehind C# call, when I access the textbox's .Text
field,
it is always empty, regardless of the actual values put in the text box.
The
really strange part of it is that when the page refreshes, the asp textbox
has the correct values in the input tag's value attribute.

Is there some wierd execution order to ASP.NET that I am unaware of that
would cause this? And, more importantly, is there a way around it? any
help
would be greatly appreciated.


Nov 19 '05 #4

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

Similar topics

1
6803
by: paul reed | last post by:
Hello, I am having some weird behavior between two machines...one which is running the 1.1 framework and one which is running 1.0. After opening a child form from a parent...I update the database then call the __doPostBack function of the window.opener. This has been working like a charm for the last several months. Our ISP where we run the .NET app recently upgraded to 1.1 of the framework. When I run my app at the ISP...the...
3
3815
by: VB Programmer | last post by:
I have a textbox on my webform. I can set it, like txt1.text = "hi", but if I change the text and click a button to display the current value it RETAINS the old value. Any ideas? Any ideas?
112
4007
by: Tom | last post by:
This is very strange: I have a Windows Form with a Panel on it. In that panel I dynamically (at run time) create some labels, as so: for i=1 to x dim ctlNew as New Label() with ctlNew .Name="Whatever" & trim(cstr(i)) .Text=.Name .Visible=True ... etc etc etc ...
1
1445
by: Sa¹o Zagoranski | last post by:
Hi... This is driving me crazy and I really hope I can get an answer... Take a look at the piece of code below (I'm using .net 2.0): try { double pointTime = XDate.DateTimeToXLDate(point.time); double pointValue = Convert.ToDouble(point.value); list.Add(pointTime, pointValue);
1
1202
by: Henrik B | last post by:
I'm binding data to a DropDown through a DataSource. When I select item i get some values from database trough the SelectedIndexChanged. Values is shown in textboxes. I make changes to the values and press a button to update. After postback the oldvalues is back .... the new values is gone ... Is this a binding issue? State of dropdown works .. The selected item in dropdown is always shown after postback. This is driving me nuts .... ...
3
1544
by: Tom | last post by:
We are experiencing some wierd debugging behavior. What happens is that, during debugging with VS 2003, the debugger seems to 'skip' statements that are associated with database operations. For instance, I can be single-stepping through a VB.NET program, and once I hit a DB related statement (such as setting command parameters, executing a data reader, etc) the debugger will simply 'skip' ahead a number of statements (if not all the way to...
0
1592
by: Tom | last post by:
I have some very strange issues with combo boxes on a tab control. Here's the scenario: I have a Windows Forms form that has a tab control on it, with two (2) tabs. Tab 2 happens to have a number of text and combo boxes on it (in panels on the tab). These combos were originally simple drop down lists - i.e. you had to select from the list and couldn't enter anything of your own. At that time everything worked fine. Now, the users...
4
1514
by: Muthu Arumugam | last post by:
Tried the following c# code static void Main(string args) { ArrayList list = new ArrayList(); int i = 10;
1
1291
by: =?Utf-8?B?Um9iZXJ0IFNtaXRo?= | last post by:
Hi, I have a behavior file called ScrollPos.htc, which is supposed to maintain the scroll position of a datagrid within a div tag. In my html I have <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="MaintainScrollDemo" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
0
8269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8512
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2630
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 we have to send another system
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.