473,480 Members | 4,841 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Weird problem

Hello,

I have an ASP.NET page with a form

<form id="myform" method="post" runat="server">
<asp:panel id="pnl1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute;
TOP: 8px" runat="server"
Height="572px" Width="360px">
<asp:button id="cmdSubmit" runat="server" Text="Submit"></asp:button>
</asp:panel>
<asp:panel id="pnl2" style="Z-INDEX: 103; LEFT: 8px; POSITION: absolute;
TOP: 592px"
runat="server" Height="152px" Width="360px">
<asp:TextBox id="txt" runat="server"></asp:TextBox>
</asp:panel>

On the code-behind C# file, I intercept the cmdSubmit.Click event:

private void cmdSubmit_Click(object sender, System.EventArgs e)
{
string s = txt.Text;
}
However, txt.Text always return "" no matter what I have input in the text
box. How can I fix that?

TIA,

Arthur
Nov 19 '05 #1
3 1516
Works fine for me. If you are just doing a Response.Write(s), the text will
show up behind the button and you won't see it *chuckle*

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Arthur Hsu" <ah**@vimatech.com> wrote in message
news:Oo**************@TK2MSFTNGP12.phx.gbl...
Hello,

I have an ASP.NET page with a form

<form id="myform" method="post" runat="server">
<asp:panel id="pnl1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server"
Height="572px" Width="360px">
<asp:button id="cmdSubmit" runat="server" Text="Submit"></asp:button>
</asp:panel>
<asp:panel id="pnl2" style="Z-INDEX: 103; LEFT: 8px; POSITION: absolute; TOP: 592px"
runat="server" Height="152px" Width="360px">
<asp:TextBox id="txt" runat="server"></asp:TextBox>
</asp:panel>

On the code-behind C# file, I intercept the cmdSubmit.Click event:

private void cmdSubmit_Click(object sender, System.EventArgs e)
{
string s = txt.Text;
}
However, txt.Text always return "" no matter what I have input in the text
box. How can I fix that?

TIA,

Arthur

Nov 19 '05 #2
I found out the possible reason. The machine has hardware defects. Its
hard drive is dead today, and the memory is also bad.
On the replacement machine I got no problem at all.

Still thanks for you guys' help.

-Arthur

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:S6**************@cpmsftngxa10.phx.gbl...
Hi Arthur,

From your description ,you can't get a TextBox's new inputed values in a
Button's Click event. I'm not sure on your complete page content and code
behind file but I don't think this will be a big problem. Maybe we just
miss somethings in the codebehind or ... I've attached a simple test
page
in this message, you can have a try on your side to verify whether there
is
anything different in your page.
If you have any other questions, please feel free to let me know. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #3
You're welcome Arthur,

Good luck!

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #4

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

Similar topics

3
2063
by: redneck_kiwi | last post by:
Hi all: I have a really weird problem. I am developing a customer catalog system for my company and as such have delved into sessions for authentication and access levels. So far, I have managed...
13
3775
by: Wolfgang Kaml | last post by:
Hello All, I have been researching newsgroups and knowledgebase all morning and not found a solution that would solve the problem I have. I am having an ASP or ASPX web page that implement a...
1
2073
by: Kaneda | last post by:
Hello everyone! I have some weird(?) problems, and I am not quite sure if there are due to my errors or maybe a limitation in the .Net framework. I have a ComboBox I need to fill with the...
0
1142
by: Kaneda | last post by:
Hello everyone! I have some weird(?) problems, and I am not quite sure if there are due to my errors or maybe a limitation in the .Net framework. I have a ComboBox I need to fill with the...
6
1384
by: Unicorn | last post by:
I can only say this is a weird problem! I will be sitting there typing away in the code window, when the whole IDE just vanishes without a trace. I get no error messages and no indication, it...
1
1512
by: Jeffrey Melloy | last post by:
I recently noticed that in my web app, a \n wasn't getting converted to a <br />. (The problem turned out to be that for this particular record, it was a \r). When I checked out the record in...
0
1426
by: Zwyatt | last post by:
having a really weird little bug w/ time_t...check it out: I have the following code (simplified here): #include <time.h> class A { public: char *aString; int aNum;
1
1536
by: Strange Cat | last post by:
Hi everyone! I have a weird problem with FormsAuthentication. I have an app that works just fine with FormsAuthentication. The user requests the homepage, he is redirected to login page,...
3
5442
by: aling | last post by:
Execute following T-SQL within Queary Analyzer of SQL Server 2000: ======================================= DECLARE @dTest DATETIME SET @dTest='2001-1-1 1:1:1:991' SELECT @dTest SET...
0
1807
by: P Pulkkinen | last post by:
Dear all, sorry, i know this code is far little too long to debug here, but there is really annoying logical error. If someone debugs this, I really offer warm virtual handshake. What this...
0
7040
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
7080
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...
1
6736
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6908
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...
0
5331
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,...
0
4478
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...
0
2994
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
2980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
178
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.