473,385 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 programmatically 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 2062
Do you have anything in onload event and if so Do you handle IsPostBack?
"Michael Loughry" <Mi************@discussions.microsoft.com> wrote in
message news:31**********************************@microsof t.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 programmatically
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.microsoft.com> wrote in
message news:31**********************************@microsof t.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 programmatically
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.microsoft.com> wrote in
message news:31**********************************@microsof t.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 programmatically
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
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...
3
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
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...
1
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 =...
1
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...
3
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...
0
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...
4
by: Muthu Arumugam | last post by:
Tried the following c# code static void Main(string args) { ArrayList list = new ArrayList(); int i = 10;
1
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#"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.