Ask a Question related to ASP.NET General, Design and Development.
-
fadi #1
Re: OnClick not being called when there are validation errors
Do you happen to have smartNavigation set to true by any chance? if so, turn
it off and try it.
fadi
"Dano" <dtemple7502@rogers.com> wrote in message
news:dsDKa.18605$H9q1.13820@news04.bloor.is.net.ca ble.rogers.com...page.> Hi everyone,
>
> I am having some problems with the validator controls and the button
> controls on_click event.
>
> Suppose you have a textbox where you enter in a name. Then you have a Save
> and a Cancel button. The Cancel Button redirects the user to the mainthen> Now if you have a Required Field Validator on the textbox for the name,sub> when you hit the save and the field is empty, you get client side
> validation, and the corresponding error messages posted on the
> asp:ValidationSummary control. BUT, once this happens and you have errors
> actually listed on the page, my buttons no longer work. I stepped through
> the code, and in this case when a button is clicked, the server On_LoadCausesValidation> is run, but once this is run the button's On_Click sub (which was working
> fine before), is no longer run. This happens even when therunat="server"> is set to false on the Cancel Button.
>
> Here is the code
>
> <asp:ValidationSummary ID="valSummary" Runat="server" HeaderText="The
> following errors were found:" showsummary="true" DisplayMode="List" />
>
>
>
> <asp:RequiredFieldValidator ID="valName" Runat="server"
> ControlToValidate="txtName" ErrorMessage="* You must enter a name"
> Display="Dynamic">*</asp:RequiredFieldValidator><asp:textbox ID="txtName"
> Runat="server" />
>
>
>
> <asp:Button ID='btnSave' Text="Save" CausesValidation="True"redirect> OnClick="saveInfo"></asp:Button>
>
>
>
>
> <asp:Button id="btnReturn" Text="Cancel" runat="server"
> CausesValidation="False" OnClick="goToMainPage"></asp:Button>
>
> </Code>
>
>
> The actual content of the OnClick sub itself is moot, since in the
> problematic case, it is no longer called. In my case it is a singleare> line. Does anyone know why my OnClick routines no longer work when there> validation errors, even though CausesValidation is set to false?
>
> Dano
>
>
fadi Guest
-
#39868 [NEW]: Destructor is called allthought constructor is never called
From: jb at ez dot no Operating system: Kubuntu 6.10 PHP version: 5.2.0 PHP Bug Type: *General Issues Bug description: ... -
#39678 [Opn->Bgs]: __set and __get not called where a class attribute is called statically
ID: 39678 Updated by: tony2001@php.net Reported By: denis at edistar dot com -Status: Open +Status: ... -
#39678 [NEW]: __set and __get not called where a class attribute is called statically
From: denis at edistar dot com Operating system: Linux PHP version: 5.2.0 PHP Bug Type: Scripting Engine problem Bug... -
xhtml Validation Errors
Hello. I am just learning to update html to xhtml and had a few validation errors I wondered if you could help me with. The first one says:... -
validation summary doesnt display when there's client-side validation
I have a custom validator that validates a numeric field, txtField, that allows for thousand separators. I also placed a validation summary so... -
Dano #2
Re: OnClick not being called when there are validation errors
I do indeed have smartNavigation on and you were absolutely right! Turning
it off made the page behave properly, how did you know?
So what exactly was happening? And is there anyway I can get
smartNavigation and these validator controls to play nice together? Yeah, I
know, I'm a picky guy ...
Thanks for the info though!
Dano
"fadi" <fadiz@nospam.com> wrote in message
news:#9G1B4$ODHA.3192@TK2MSFTNGP10.phx.gbl...turn> Do you happen to have smartNavigation set to true by any chance? if so,Save> it off and try it.
>
> fadi
>
> "Dano" <dtemple7502@rogers.com> wrote in message
> news:dsDKa.18605$H9q1.13820@news04.bloor.is.net.ca ble.rogers.com...> > Hi everyone,
> >
> > I am having some problems with the validator controls and the button
> > controls on_click event.
> >
> > Suppose you have a textbox where you enter in a name. Then you have aerrors> page.> > and a Cancel button. The Cancel Button redirects the user to the main> then> > Now if you have a Required Field Validator on the textbox for the name,> > when you hit the save and the field is empty, you get client side
> > validation, and the corresponding error messages posted on the
> > asp:ValidationSummary control. BUT, once this happens and you havethrough> > actually listed on the page, my buttons no longer work. I steppedworking> sub> > the code, and in this case when a button is clicked, the server On_Load> > is run, but once this is run the button's On_Click sub (which wasID="txtName"> CausesValidation> > fine before), is no longer run. This happens even when the> > is set to false on the Cancel Button.
> >
> > Here is the code
> >
> > <asp:ValidationSummary ID="valSummary" Runat="server" HeaderText="The
> > following errors were found:" showsummary="true" DisplayMode="List" />
> >
> >
> >
> > <asp:RequiredFieldValidator ID="valName" Runat="server"
> > ControlToValidate="txtName" ErrorMessage="* You must enter a name"
> > Display="Dynamic">*</asp:RequiredFieldValidator><asp:textbox> runat="server"> > Runat="server" />
> >
> >
> >
> > <asp:Button ID='btnSave' Text="Save" CausesValidation="True"> redirect> > OnClick="saveInfo"></asp:Button>
> >
> >
> >
> >
> > <asp:Button id="btnReturn" Text="Cancel" runat="server"
> > CausesValidation="False" OnClick="goToMainPage"></asp:Button>
> >
> > </Code>
> >
> >
> > The actual content of the OnClick sub itself is moot, since in the
> > problematic case, it is no longer called. In my case it is a single> are> > line. Does anyone know why my OnClick routines no longer work when there>> > validation errors, even though CausesValidation is set to false?
> >
> > Dano
> >
> >
>
Dano Guest
-
fadi #3
Re: OnClick not being called when there are validation errors
I know because we ran into that problem on a project. What happens is that
smartNavigation creates an IFRAME spanning the page and loads the page
inside it. Looks like there is a bug where javascript and Response.Redirect
may not function right at times after postbacks due to the IFRAME problem.
Not sure what is a good workaround for it, I only use smartNavigation now
for modal popup windows.
Fadi
"Dano" <dtemple7502@rogers.com> wrote in message
news:VIKKa.39693$bRt.28216@news01.bloor.is.net.cab le.rogers.com...I> I do indeed have smartNavigation on and you were absolutely right! Turning
> it off made the page behave properly, how did you know?
>
> So what exactly was happening? And is there anyway I can get
> smartNavigation and these validator controls to play nice together? Yeah,name,> know, I'm a picky guy ...
>
> Thanks for the info though!
>
> Dano
>
>
> "fadi" <fadiz@nospam.com> wrote in message
> news:#9G1B4$ODHA.3192@TK2MSFTNGP10.phx.gbl...> turn> > Do you happen to have smartNavigation set to true by any chance? if so,> Save> > it off and try it.
> >
> > fadi
> >
> > "Dano" <dtemple7502@rogers.com> wrote in message
> > news:dsDKa.18605$H9q1.13820@news04.bloor.is.net.ca ble.rogers.com...> > > Hi everyone,
> > >
> > > I am having some problems with the validator controls and the button
> > > controls on_click event.
> > >
> > > Suppose you have a textbox where you enter in a name. Then you have a> > page.> > > and a Cancel button. The Cancel Button redirects the user to the main> > > Now if you have a Required Field Validator on the textbox for theOn_Load> errors> > then> > > when you hit the save and the field is empty, you get client side
> > > validation, and the corresponding error messages posted on the
> > > asp:ValidationSummary control. BUT, once this happens and you have> through> > > actually listed on the page, my buttons no longer work. I stepped> > > the code, and in this case when a button is clicked, the serverthere> working> > sub> > > is run, but once this is run the button's On_Click sub (which was> ID="txtName"> > CausesValidation> > > fine before), is no longer run. This happens even when the> > > is set to false on the Cancel Button.
> > >
> > > Here is the code
> > >
> > > <asp:ValidationSummary ID="valSummary" Runat="server" HeaderText="The
> > > following errors were found:" showsummary="true" DisplayMode="List" />
> > >
> > >
> > >
> > > <asp:RequiredFieldValidator ID="valName" Runat="server"
> > > ControlToValidate="txtName" ErrorMessage="* You must enter a name"
> > > Display="Dynamic">*</asp:RequiredFieldValidator><asp:textbox> > runat="server"> > > Runat="server" />
> > >
> > >
> > >
> > > <asp:Button ID='btnSave' Text="Save" CausesValidation="True"> > redirect> > > OnClick="saveInfo"></asp:Button>
> > >
> > >
> > >
> > >
> > > <asp:Button id="btnReturn" Text="Cancel" runat="server"
> > > CausesValidation="False" OnClick="goToMainPage"></asp:Button>
> > >
> > > </Code>
> > >
> > >
> > > The actual content of the OnClick sub itself is moot, since in the
> > > problematic case, it is no longer called. In my case it is a single> > > line. Does anyone know why my OnClick routines no longer work when>> > are> >> > > validation errors, even though CausesValidation is set to false?
> > >
> > > Dano
> > >
> > >
> >
>
fadi Guest



Reply With Quote

