Here is the code for a webcontrol, quite simple:
-------------------------------------------------------------------------------------------------------------
<%@ Control Language="c#" AutoEventWireup ="false"
Codebehind="Web UserControl1.as cx.cs"
Inherits="WebAp plication23.Web UserControl1"
TargetSchema="h ttp://schemas.microso ft.com/intellisense/ie5"%>
<STYLE>
..ModuleContent P { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana,
Helvetica }
LI { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica }
A { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica }
TD { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica }
TH { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica }
DIV { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica }
</STYLE>
<table cellSpacing="0" cellPadding="0" width="490" border="0">
<tr>
<td width="5%"></td>
<td width="95%"><as p:label id="lblMessage " runat="server"
EnableViewState ="False" ForeColor="Red"
Font-Bold="True"></asp:label><asp: validationsumma ry id="ValSummary "
runat="server" Font-Bold="True"
DisplayMode="Si ngleParagraph"> </asp:validations ummary><br>
<table cellSpacing="0" cellPadding="5" border="0" width="100%">
<tr bgColor="#ebebe b">
<td colSpan="2"></td>
</tr>
<tr bgColor="#ebebe b">
<td style="WIDTH: 105px" width="105">&nb sp;ID (min 4 char):</td>
<td width="78%">&nb sp;
<asp:textbox id="txtID" runat="server" Width="250px"></asp:textbox>
<asp:label id="lblID" runat="server"> (ex.A5570A)</asp:label>  ;
<asp:regularexp ressionvalidato r id="RegExpValId " runat="server"
Font-Bold="True" ValidationExpre ssion=".{4,}" ControlToValida te="txtID"
Display="Dynami c" Font-Size="Medium" ErrorMessage="T his is the error
message!">*</asp:regularexpr essionvalidator ></td>
</tr>
<tr bgColor="#ebebe b">
<td colSpan="2"><as p:button id="btnSearch" runat="server"
Text="Search"></asp:button>&nbs p;</td>
</tr>
</table>
</td>
</tr>
</table>
----------------------------------------------------------------------------------------------------------
A rather simple form, The webcontrol contains a textbox and a validation
control.
the button needs to click twice to show the summary error message!
The question can be resolved by one of the following operations:
1,change the textbox's width or remove the css
2,I remove the left side table cell
3,change the label lblID's text to either "(ex.A5570A A)" or "(ex.A5570) ".
But I want to know why? 3 2509
Wang wrote: Here is the code for a webcontrol, quite simple: --------------------------------------------------------------------------
----------------------------------- <%@ Control Language="c#" AutoEventWireup ="false" Codebehind="Web UserControl1.as cx.cs" Inherits="WebAp plication23.Web UserControl1" TargetSchema="h ttp://schemas.microso ft.com/intellisense/ie5"%> <STYLE> .ModuleContent P { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } LI { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } A { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } TD { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } TH { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } DIV { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } </STYLE> <table cellSpacing="0" cellPadding="0" width="490" border="0"> <tr> <td width="5%"></td> <td width="95%"><as p:label id="lblMessage " runat="server" EnableViewState ="False" ForeColor="Red" Font-Bold="True"></asp:label><asp: validationsumma ry id="ValSummary " runat="server" Font-Bold="True" DisplayMode="Si ngleParagraph"> </asp:validations ummary><br> <table cellSpacing="0" cellPadding="5" border="0" width="100%"> <tr bgColor="#ebebe b"> <td colSpan="2"></td> </tr> <tr bgColor="#ebebe b"> <td style="WIDTH: 105px" width="105">&nb sp;ID (min 4 char):</td> <td width="78%">&nb sp; <asp:textbox id="txtID" runat="server" Width="250px"></asp:textbox> <asp:label id="lblID" runat="server"> (ex.A5570A)</asp:label>  ; <asp:regularexp ressionvalidato r id="RegExpValId " runat="server" Font-Bold="True" ValidationExpre ssion=".{4,}" ControlToValida te="txtID" Display="Dynami c" Font-Size="Medium" ErrorMessage="T his is the error message!">*</asp:regularexpr essionvalidator ></td> </tr> <tr bgColor="#ebebe b"> <td colSpan="2"><as p:button id="btnSearch" runat="server" Text="Search"></asp:button>&nbs p;</td> </tr> </table> </td> </tr> </table>
--------------------------------------------------------------------------
--------------------------------
A rather simple form, The webcontrol contains a textbox and a validation control.
the button needs to click twice to show the summary error message!
The question can be resolved by one of the following operations: 1,change the textbox's width or remove the css 2,I remove the left side table cell 3,change the label lblID's text to either "(ex.A5570A A)" or "(ex.A5570) ".
But I want to know why?
I'm guessing that the problem is in your page, not in your control.
How is the control generated on the page?
If it is generated dynamically, make sure it gets the same ID
before and after postback.
Otherwise, your button will also get a different ID after
postback, causing event handling to fail.
The first and the second postback on the other hand will
generate the same ID's, allowing a successful event handling.
--
Jos
Hi
Would you pls try it on your side?
The second round will run success withoud a postback!
How to explain why the page functions well after I change the label's text?
--
Hobbes
"Jos" <jn************ *@fastmail.fm> wrote in message
news:ud******** ******@TK2MSFTN GP15.phx.gbl... Wang wrote: Here is the code for a webcontrol, quite simple: -------------------------------------------------------------------------- ----------------------------------- <%@ Control Language="c#" AutoEventWireup ="false" Codebehind="Web UserControl1.as cx.cs" Inherits="WebAp plication23.Web UserControl1" TargetSchema="h ttp://schemas.microso ft.com/intellisense/ie5"%> <STYLE> .ModuleContent P { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } LI { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } A { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } TD { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } TH { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } DIV { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } </STYLE> <table cellSpacing="0" cellPadding="0" width="490" border="0"> <tr> <td width="5%"></td> <td width="95%"><as p:label id="lblMessage " runat="server" EnableViewState ="False" ForeColor="Red" Font-Bold="True"></asp:label><asp: validationsumma ry id="ValSummary " runat="server" Font-Bold="True" DisplayMode="Si ngleParagraph"> </asp:validations ummary><br> <table cellSpacing="0" cellPadding="5" border="0" width="100%"> <tr bgColor="#ebebe b"> <td colSpan="2"></td> </tr> <tr bgColor="#ebebe b"> <td style="WIDTH: 105px" width="105">&nb sp;ID (min 4 char):</td> <td width="78%">&nb sp; <asp:textbox id="txtID" runat="server" Width="250px"></asp:textbox> <asp:label id="lblID" runat="server"> (ex.A5570A)</asp:label>  ; <asp:regularexp ressionvalidato r id="RegExpValId " runat="server" Font-Bold="True" ValidationExpre ssion=".{4,}" ControlToValida te="txtID" Display="Dynami c" Font-Size="Medium" ErrorMessage="T his is the error message!">*</asp:regularexpr essionvalidator ></td> </tr> <tr bgColor="#ebebe b"> <td colSpan="2"><as p:button id="btnSearch" runat="server" Text="Search"></asp:button>&nbs p;</td> </tr> </table> </td> </tr> </table>
-------------------------------------------------------------------------- --------------------------------
A rather simple form, The webcontrol contains a textbox and a validation control.
the button needs to click twice to show the summary error message!
The question can be resolved by one of the following operations: 1,change the textbox's width or remove the css 2,I remove the left side table cell 3,change the label lblID's text to either "(ex.A5570A A)" or "(ex.A5570) ".
But I want to know why?
I'm guessing that the problem is in your page, not in your control.
How is the control generated on the page? If it is generated dynamically, make sure it gets the same ID before and after postback.
Otherwise, your button will also get a different ID after postback, causing event handling to fail.
The first and the second postback on the other hand will generate the same ID's, allowing a successful event handling.
--
Jos
I've seen this behavior before (many times). The button is below a validator
that has Display=Dynamic . So that validator is entirely hidden.
When it appears, the button moves down.
Now when you edit the textbox with some illegal data and click on the
button, the first thing that happens is the validator fires due to the
"onchange" event (the button has not yet run). The validator appears. The
button that you are clicking on has just moved. Due to this shift, your
click is ignored.
Solution: Make sure the button does not jump in situations like this by
redesigning your page. Perhaps you should just use Display=Static on the
validator.
--- Peter Blum www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at http://www.peterblum.com/vam/home.aspx
"Wang" <ho****@sccd.cn uninet.net> wrote in message
news:ul******** ********@tk2msf tngp13.phx.gbl. .. Here is the code for a webcontrol, quite simple: ------------------------------------------------------------------------------------------------------------- <%@ Control Language="c#" AutoEventWireup ="false" Codebehind="Web UserControl1.as cx.cs" Inherits="WebAp plication23.Web UserControl1" TargetSchema="h ttp://schemas.microso ft.com/intellisense/ie5"%> <STYLE> .ModuleContent P { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } LI { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } A { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } TD { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } TH { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } DIV { FONT-SIZE: x-small; FONT-FAMILY: Arial, Verdana, Helvetica } </STYLE> <table cellSpacing="0" cellPadding="0" width="490" border="0"> <tr> <td width="5%"></td> <td width="95%"><as p:label id="lblMessage " runat="server" EnableViewState ="False" ForeColor="Red" Font-Bold="True"></asp:label><asp: validationsumma ry id="ValSummary " runat="server" Font-Bold="True" DisplayMode="Si ngleParagraph"> </asp:validations ummary><br> <table cellSpacing="0" cellPadding="5" border="0" width="100%"> <tr bgColor="#ebebe b"> <td colSpan="2"></td> </tr> <tr bgColor="#ebebe b"> <td style="WIDTH: 105px" width="105">&nb sp;ID (min 4 char):</td> <td width="78%">&nb sp; <asp:textbox id="txtID" runat="server" Width="250px"></asp:textbox> <asp:label id="lblID" runat="server"> (ex.A5570A)</asp:label>  ; <asp:regularexp ressionvalidato r id="RegExpValId " runat="server" Font-Bold="True" ValidationExpre ssion=".{4,}" ControlToValida te="txtID" Display="Dynami c" Font-Size="Medium" ErrorMessage="T his is the error message!">*</asp:regularexpr essionvalidator ></td> </tr> <tr bgColor="#ebebe b"> <td colSpan="2"><as p:button id="btnSearch" runat="server" Text="Search"></asp:button>&nbs p;</td> </tr> </table> </td> </tr> </table>
----------------------------------------------------------------------------------------------------------
A rather simple form, The webcontrol contains a textbox and a validation control.
the button needs to click twice to show the summary error message!
The question can be resolved by one of the following operations: 1,change the textbox's width or remove the css 2,I remove the left side table cell 3,change the label lblID's text to either "(ex.A5570A A)" or "(ex.A5570) ".
But I want to know why? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Baoqiu Cui |
last post by:
Today I was playing with a small Python program using Python 2.4
on Cygwin (up-to-date version, on Windows XP), but ran into a
strange error on the following small program (named bug.py):
-------------------------------
#!/usr/bin/python
class Person:
population = 0
def __del__(self):
|
by: Antonio Maiorano |
last post by:
Hi everyone,
I use Visual Studio .NET 2002 right now, and I discovered a bug last night
that I have found few references to on the internet. Basically, if you
allocated a null-terminated char array that is 16 bytes or longer to
std::string, it stores garbage into it:
std::string s = "1234567890123456";
I tried this on .NET 2003 at...
|
by: Drew D. Saur |
last post by:
Hello, all.
I have searched and searched and searched for details about what I am
experiencing, but I can't find a reference anywhere. I know IE has some
interesting bugs regarding floats - many of which the insane "display:
inline" will fix - but this one us a real stumper.
Visit:
http://www.macorchard.com/junk/bug/
|
by: Jerry |
last post by:
I managed to narrow this down to a very simple expression. try this:
private void Bug()
{
bool b = false;
Test(3, (b || b) && b && !b);
}
private void Works()
{
|
by: Maxim Yegorushkin |
last post by:
The following code:
#include <iostream>
class base
{
private:
virtual ~base()
{
std::cout << "virtual ~base()\n";
| |
by: Xah Lee |
last post by:
i had the pleasure to read the PHP's manual today.
http://www.php.net/manual/en/
although Pretty Home Page is another criminal hack of the unix lineage,
but if we are here to judge the quality of its documentation, it is a
impeccability.
it has or possesses properties of:
|
by: GaryDean |
last post by:
A couple of weeks ago I reported a bug in vs2005 where it corrupted projects
converted from vs2003 if a 2003 dataset were modified or recreated. Steven
Cheng was able to recreate the bug. I reported the bug and Steven
said he was also going to report the bug.
From a practical standpoint this bug prevents migration of projects from...
|
by: Edward Diener |
last post by:
After spending more than a day reducing a complicated compiler bug to a
simple case I reported it to the MSDN Product Feedback Center as a bug
just now. However this bug is completely stymying my development of a
VC++ component. Does Microsoft still offer any free bug reporting cases
for VS2005, as they did two for VS2003 so that I can talk...
|
by: Patient Guy |
last post by:
The code below shows the familiar way of restricting a function to be a
method of a constructed object:
function aConstructor(arg)
{
if (typeof(arg) == "undefined")
return (null);
this.property1 = arg;
this.property2 = aConstantDefinedGlobally;
this.method1 = function (anArg) {
|
by: Juan T. Llibre |
last post by:
re:
!I found an MSDN document that explains why what I'm trying to do should work
Lee,
From :
http://www.w3.org/TR/REC-xml/
"A special attribute named xml:lang may be inserted in documents to specify the
|
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...
| |
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. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |