Showing posts with label textbox. Show all posts
Showing posts with label textbox. Show all posts

Saturday, March 31, 2012

Strange Behavior from RequiredFieldValidator (and Two LinkButtons)

We have an ASP.NET web form with 1 TextBox, 2 LinkButtons, and 1
RequireFieldValidator. The situation is: the user needs to enter a folder
name in the TextBox and click the first LinkButton (the Create Folder
LinkButton) to create the folder. Then once that's done, they need to click
the second LinkButton (the Next LinkButton) to go to the next page (a
rudimentary wizard).
The RequiredFieldValidator is there to make sure the user enters a folder
name in the TextBox before clicking the first LinkButton (the Create Folder
LinkButton). This all works fine.
What's strange is if the user doesn't enter anything in the TextBox and
clicks the second LinkButton (the Next LinkButton) before clicking the first
LinkButton (the Create Folder LinkButton), the RequiredFieldValidator alarms
the error anyway.
Is this correct behavior? What we want is for the first LinkButton (the
Create Report LinkButton) only to validate that text has been entered in the
TextBox, not the second LinkButton (the Next LinkButton). How can we do
this?Hi JJ,
The function of the requiredfield validator is just to check the txtbox is
having some value or not.
If you want that checking has to be made only for the first link button and
not for the second link button, then specifically you have to inform the
validator as follows.
1. Click the second link button and go to the properties window.
2. Set the cause validation property to False.
So, here after when you are click second link button form will not do any
validations.
Hope this helps you.
Cheers,
Jerome. M
"JJ" wrote:

> We have an ASP.NET web form with 1 TextBox, 2 LinkButtons, and 1
> RequireFieldValidator. The situation is: the user needs to enter a folder
> name in the TextBox and click the first LinkButton (the Create Folder
> LinkButton) to create the folder. Then once that's done, they need to cli
ck
> the second LinkButton (the Next LinkButton) to go to the next page (a
> rudimentary wizard).
> The RequiredFieldValidator is there to make sure the user enters a folder
> name in the TextBox before clicking the first LinkButton (the Create Folde
r
> LinkButton). This all works fine.
> What's strange is if the user doesn't enter anything in the TextBox and
> clicks the second LinkButton (the Next LinkButton) before clicking the fir
st
> LinkButton (the Create Folder LinkButton), the RequiredFieldValidator alar
ms
> the error anyway.
> Is this correct behavior? What we want is for the first LinkButton (the
> Create Report LinkButton) only to validate that text has been entered in t
he
> TextBox, not the second LinkButton (the Next LinkButton). How can we do
> this?
>
>

Strange Behavior from RequiredFieldValidator (and Two LinkButtons)

We have an ASP.NET web form with 1 TextBox, 2 LinkButtons, and 1
RequireFieldValidator. The situation is: the user needs to enter a folder
name in the TextBox and click the first LinkButton (the Create Folder
LinkButton) to create the folder. Then once that's done, they need to click
the second LinkButton (the Next LinkButton) to go to the next page (a
rudimentary wizard).

The RequiredFieldValidator is there to make sure the user enters a folder
name in the TextBox before clicking the first LinkButton (the Create Folder
LinkButton). This all works fine.

What's strange is if the user doesn't enter anything in the TextBox and
clicks the second LinkButton (the Next LinkButton) before clicking the first
LinkButton (the Create Folder LinkButton), the RequiredFieldValidator alarms
the error anyway.

Is this correct behavior? What we want is for the first LinkButton (the
Create Report LinkButton) only to validate that text has been entered in the
TextBox, not the second LinkButton (the Next LinkButton). How can we do
this?Hi JJ,

The function of the requiredfield validator is just to check the txtbox is
having some value or not.

If you want that checking has to be made only for the first link button and
not for the second link button, then specifically you have to inform the
validator as follows.

1. Click the second link button and go to the properties window.

2. Set the cause validation property to False.

So, here after when you are click second link button form will not do any
validations.

Hope this helps you.

Cheers,

Jerome. M

"JJ" wrote:

> We have an ASP.NET web form with 1 TextBox, 2 LinkButtons, and 1
> RequireFieldValidator. The situation is: the user needs to enter a folder
> name in the TextBox and click the first LinkButton (the Create Folder
> LinkButton) to create the folder. Then once that's done, they need to click
> the second LinkButton (the Next LinkButton) to go to the next page (a
> rudimentary wizard).
> The RequiredFieldValidator is there to make sure the user enters a folder
> name in the TextBox before clicking the first LinkButton (the Create Folder
> LinkButton). This all works fine.
> What's strange is if the user doesn't enter anything in the TextBox and
> clicks the second LinkButton (the Next LinkButton) before clicking the first
> LinkButton (the Create Folder LinkButton), the RequiredFieldValidator alarms
> the error anyway.
> Is this correct behavior? What we want is for the first LinkButton (the
> Create Report LinkButton) only to validate that text has been entered in the
> TextBox, not the second LinkButton (the Next LinkButton). How can we do
> this?
>

Wednesday, March 28, 2012

Strange Characters

Hello,
I have a form with a textbox.
When I click submit the text in the textbox changes.
For example "Andr=E9 Sousa" becomes "Andr=C3=A9 Sousa"
What is wrong and how can I solve this?
Thanks,
Miguel"shapper" <mdmoura@.gmail.com> wrote in message
news:1169488427.871757.44860@.s34g2000cwa.googlegroups.com...
For example "Andr Sousa" becomes "André Sousa"
Whenever one "unusual" character gets substitued by two even more "unusual"
characters, you can be pretty certain it's a Unicode encoding issue...
Post your code...

Strange Characters

Hello,

I have a form with a textbox.

When I click submit the text in the textbox changes.

For example "Andr Sousa" becomes "André Sousa"

What is wrong and how can I solve this?

Thanks,

Miguel"shapper" <mdmoura@.gmail.comwrote in message
news:1169488427.871757.44860@.s34g2000cwa.googlegro ups.com...

For example "Andr Sousa" becomes "André Sousa"

Whenever one "unusual" character gets substitued by two even more "unusual"
characters, you can be pretty certain it's a Unicode encoding issue...

Post your code...

Strange characters

Hello,

I have a form with a textbox.

When I click submit the text in the textbox changes.

For example "André Sousa" becomes "Andr?? Sousa"

What is wrong and how can I solve this?

Thanks,

Miguel

try use

Server.HtmlDecode
Server.HtmlEncode

see how it goes


Hi,

Can you show me your code, I am glad to check it in my computer for you.

Thursday, March 22, 2012

Strange issue with textbox

All

Have a form with 6 textboxes.

3 of these have a white background but for some strage
reason the 3 others are yellow, I cannot for the life of
me find out why the other 3 are yellow backgrounded.

This is a "copied" layout of the form,

Thanks in advanceHave you installed the Google Toolbar by any chance?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.

"yop" <yop@.oceanfree.net> wrote in message
news:06df01c367f5$0fb4c720$a001280a@.phx.gbl...
> All
> Have a form with 6 textboxes.
> 3 of these have a white background but for some strage
> reason the 3 others are yellow, I cannot for the life of
> me find out why the other 3 are yellow backgrounded.
> This is a "copied" layout of the form,
> Thanks in advance
Kevin

I have alright! :)

>--Original Message--
>Have you installed the Google Toolbar by any chance?
>--
>HTH,
>Kevin Spencer
>Microsoft MVP
>..Net Developer
>http://www.takempis.com
>The more I learn, the less I know.
>"yop" <yop@.oceanfree.net> wrote in message
>news:06df01c367f5$0fb4c720$a001280a@.phx.gbl...
>> All
>>
>> Have a form with 6 textboxes.
>>
>> 3 of these have a white background but for some strage
>> reason the 3 others are yellow, I cannot for the life
of
>> me find out why the other 3 are yellow backgrounded.
>>
>> This is a "copied" layout of the form,
>>
>> Thanks in advance
>
>.
There you go!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.

"yop" <yop@.oceanfree.net> wrote in message
news:0ea801c367ff$e0e94050$a501280a@.phx.gbl...
> Kevin
> I have alright! :)
>
> >--Original Message--
> >Have you installed the Google Toolbar by any chance?
> >--
> >HTH,
> >Kevin Spencer
> >Microsoft MVP
> >..Net Developer
> >http://www.takempis.com
> >The more I learn, the less I know.
> >"yop" <yop@.oceanfree.net> wrote in message
> >news:06df01c367f5$0fb4c720$a001280a@.phx.gbl...
> >> All
> >>
> >> Have a form with 6 textboxes.
> >>
> >> 3 of these have a white background but for some strage
> >> reason the 3 others are yellow, I cannot for the life
> of
> >> me find out why the other 3 are yellow backgrounded.
> >>
> >> This is a "copied" layout of the form,
> >>
> >> Thanks in advance
> >.
Thanks Kevin

that was it alright!

>--Original Message--
>There you go!
>--
>HTH,
>Kevin Spencer
>Microsoft MVP
>..Net Developer
>http://www.takempis.com
>The more I learn, the less I know.
>"yop" <yop@.oceanfree.net> wrote in message
>news:0ea801c367ff$e0e94050$a501280a@.phx.gbl...
>> Kevin
>>
>> I have alright! :)
>>
>>
>> >--Original Message--
>> >Have you installed the Google Toolbar by any chance?
>>> >--
>> >HTH,
>>> >Kevin Spencer
>> >Microsoft MVP
>> >..Net Developer
>> >http://www.takempis.com
>> >The more I learn, the less I know.
>>> >"yop" <yop@.oceanfree.net> wrote in message
>> >news:06df01c367f5$0fb4c720$a001280a@.phx.gbl...
>> >> All
>> >>
>> >> Have a form with 6 textboxes.
>> >>
>> >> 3 of these have a white background but for some
strage
>> >> reason the 3 others are yellow, I cannot for the
life
>> of
>> >> me find out why the other 3 are yellow backgrounded.
>> >>
>> >> This is a "copied" layout of the form,
>> >>
>> >> Thanks in advance
>>>> >.
>>
>.

Tuesday, March 13, 2012

Strange problem

I Have a strange problem. I have build a form in wich are some controls. Two textbox and one dropdown control.
The user can perform a search selecting a value in dropdown or inserting in textbox and click on search button.
My sub verify if dropdown control or textbox changed and build sql string.
But the strange think is that all run only when I use dropdown. If I insert value in textbox and not dropdown search don't work.
The code don't run. Why?
I have inserted OnTextChanged event in textbox html code and OnSelectedIndexChanged in dropdown html code but nothing to do!
HELP ME, PLEASE!You need to post your code so we can help you.

Strange problem setting focus on a TextBox within a WizardStep.

For testing purposes i have got a 2 step WizardControl. Eqach step contains
a text box, TextBox1 and TextBox2 respectively. If i put the following code
in the respective activate event handlers for the two steps,

TextBox1.Text ="foo";

and

TextBox2.Text = "bar";

Then in the first step the TextBox (TextBox1) contains the word foo and in
the second step the TextBox (TextBox2) contains the word bar. As you would
expect.

However if i replace the code with

TextBox1.Focus();

and

TextBox2.Focus();

Then i get the following error and i can't understand why. This is the
first time i have used Wizard controls and i'm just trying to work out how
they behave. What am i missing about Wizard controls that is causing this
behaviour.

A form tag with runat=server must exist on the Page to use SetFocus() or
the Focus property.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.InvalidOperationException: A form tag with
runat=server must exist on the Page to use SetFocus() or the Focus property.

Source Error:

Line 19: protected void WizardStep1_Activate(object sender, EventArgs e)
Line 20: {
Line 21: TextBox1.Focus();
Line 22:
Line 23: }

Source File:
E:\DevelopmentWebsite\IntranetDev\Portal\Testing\M ultiViewTest.aspx.cs
Line: 21

Stack Trace:

[InvalidOperationException: A form tag with runat=server must exist on the
Page to use SetFocus() or the Focus property.]
System.Web.UI.Page.SetFocus(Control control) +2021658
System.Web.UI.Control.Focus() +20
Testing_MultiViewTest.WizardStep1_Activate(Object sender, EventArgs e) in
E:\DevelopmentWebsite\IntranetDev\Portal\Testing\M ultiViewTest.aspx.cs:21
System.Web.UI.WebControls.View.OnActivate(EventArg s e) +105
System.Web.UI.WebControls.MultiView.set_ActiveView Index(Int32 value) +395
System.Web.UI.WebControls.MultiView.OnInit(EventAr gs e) +46
System.Web.UI.Control.InitRecursive(Control namingContainer) +321
System.Web.UI.Control.AddedControl(Control control, Int32 index) +2065279
System.Web.UI.ControlCollection.Add(Control child) +146
System.Web.UI.WebControls.Wizard.CreateControlHier archy() +2992
System.Web.UI.WebControls.Wizard.CreateChildContro ls() +126
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.WebControls.Wizard.OnInit(EventArgs e) +100
System.Web.UI.Control.InitRecursive(Control namingContainer) +321
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692On further investigation it seems that i can't set the focus on any control
from within the activate event. I have no problems however, setting the
focus onto the textbox controls within the wizardsetps, from the Page_load
event

"clickon" wrote:

> For testing purposes i have got a 2 step WizardControl. Eqach step contains
> a text box, TextBox1 and TextBox2 respectively. If i put the following code
> in the respective activate event handlers for the two steps,
> TextBox1.Text ="foo";
> and
> TextBox2.Text = "bar";
> Then in the first step the TextBox (TextBox1) contains the word foo and in
> the second step the TextBox (TextBox2) contains the word bar. As you would
> expect.
> However if i replace the code with
> TextBox1.Focus();
> and
> TextBox2.Focus();
> Then i get the following error and i can't understand why. This is the
> first time i have used Wizard controls and i'm just trying to work out how
> they behave. What am i missing about Wizard controls that is causing this
> behaviour.
> A form tag with runat=server must exist on the Page to use SetFocus() or
> the Focus property.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information about
> the error and where it originated in the code.
> Exception Details: System.InvalidOperationException: A form tag with
> runat=server must exist on the Page to use SetFocus() or the Focus property.
> Source Error:
> Line 19: protected void WizardStep1_Activate(object sender, EventArgs e)
> Line 20: {
> Line 21: TextBox1.Focus();
> Line 22:
> Line 23: }
>
> Source File:
> E:\DevelopmentWebsite\IntranetDev\Portal\Testing\M ultiViewTest.aspx.cs
> Line: 21
> Stack Trace:
> [InvalidOperationException: A form tag with runat=server must exist on the
> Page to use SetFocus() or the Focus property.]
> System.Web.UI.Page.SetFocus(Control control) +2021658
> System.Web.UI.Control.Focus() +20
> Testing_MultiViewTest.WizardStep1_Activate(Object sender, EventArgs e) in
> E:\DevelopmentWebsite\IntranetDev\Portal\Testing\M ultiViewTest.aspx.cs:21
> System.Web.UI.WebControls.View.OnActivate(EventArg s e) +105
> System.Web.UI.WebControls.MultiView.set_ActiveView Index(Int32 value) +395
> System.Web.UI.WebControls.MultiView.OnInit(EventAr gs e) +46
> System.Web.UI.Control.InitRecursive(Control namingContainer) +321
> System.Web.UI.Control.AddedControl(Control control, Int32 index) +2065279
> System.Web.UI.ControlCollection.Add(Control child) +146
> System.Web.UI.WebControls.Wizard.CreateControlHier archy() +2992
> System.Web.UI.WebControls.Wizard.CreateChildContro ls() +126
> System.Web.UI.Control.EnsureChildControls() +87
> System.Web.UI.WebControls.Wizard.OnInit(EventArgs e) +100
> System.Web.UI.Control.InitRecursive(Control namingContainer) +321
> System.Web.UI.Control.InitRecursive(Control namingContainer) +198
> System.Web.UI.Control.InitRecursive(Control namingContainer) +198
> System.Web.UI.Control.InitRecursive(Control namingContainer) +198
> System.Web.UI.Control.InitRecursive(Control namingContainer) +198
> System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692

Strange problem setting focus on a TextBox within a WizardStep.

For testing purposes i have got a 2 step WizardControl. Eqach step contains
a text box, TextBox1 and TextBox2 respectively. If i put the following code
in the respective activate event handlers for the two steps,
TextBox1.Text ="foo";
and
TextBox2.Text = "bar";
Then in the first step the TextBox (TextBox1) contains the word foo and in
the second step the TextBox (TextBox2) contains the word bar. As you would
expect.
However if i replace the code with
TextBox1.Focus();
and
TextBox2.Focus();
Then i get the following error and i can't understand why. This is the
first time i have used Wizard controls and i'm just trying to work out how
they behave. What am i missing about Wizard controls that is causing this
behaviour.
A form tag with runat=server must exist on the Page to use SetFocus() or
the Focus property.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information abou
t
the error and where it originated in the code.
Exception Details: System.InvalidOperationException: A form tag with
runat=server must exist on the Page to use SetFocus() or the Focus property.
Source Error:
Line 19: protected void WizardStep1_Activate(object sender, EventArgs e)
Line 20: {
Line 21: TextBox1.Focus();
Line 22:
Line 23: }
Source File:
E:\DevelopmentWebsite\IntranetDev\Portal
\Testing\MultiViewTest.aspx.cs
Line: 21
Stack Trace:
[InvalidOperationException: A form tag with runat=server must exist on the
Page to use SetFocus() or the Focus property.]
System.Web.UI.Page.SetFocus(Control control) +2021658
System.Web.UI.Control.Focus() +20
Testing_MultiViewTest.WizardStep1_Activate(Object sender, EventArgs e) in
E:\DevelopmentWebsite\IntranetDev\Portal
\Testing\MultiViewTest.aspx.cs:21
System.Web.UI.WebControls.View.OnActivate(EventArgs e) +105
System.Web.UI.WebControls.MultiView.set_ActiveViewIndex(Int32 value) +395
System.Web.UI.WebControls.MultiView.OnInit(EventArgs e) +46
System.Web.UI.Control.InitRecursive(Control namingContainer) +321
System.Web.UI.Control.AddedControl(Control control, Int32 index) +2065279
System.Web.UI.ControlCollection.Add(Control child) +146
System.Web.UI.WebControls.Wizard.CreateControlHierarchy() +2992
System.Web.UI.WebControls.Wizard.CreateChildControls() +126
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.WebControls.Wizard.OnInit(EventArgs e) +100
System.Web.UI.Control.InitRecursive(Control namingContainer) +321
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Control.InitRecursive(Control namingContainer) +198
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692On further investigation it seems that i can't set the focus on any control
from within the activate event. I have no problems however, setting the
focus onto the textbox controls within the wizardsetps, from the Page_load
event
"clickon" wrote:

> For testing purposes i have got a 2 step WizardControl. Eqach step contai
ns
> a text box, TextBox1 and TextBox2 respectively. If i put the following co
de
> in the respective activate event handlers for the two steps,
> TextBox1.Text ="foo";
> and
> TextBox2.Text = "bar";
> Then in the first step the TextBox (TextBox1) contains the word foo and i
n
> the second step the TextBox (TextBox2) contains the word bar. As you woul
d
> expect.
> However if i replace the code with
> TextBox1.Focus();
> and
> TextBox2.Focus();
> Then i get the following error and i can't understand why. This is the
> first time i have used Wizard controls and i'm just trying to work out how
> they behave. What am i missing about Wizard controls that is causing this
> behaviour.
> A form tag with runat=server must exist on the Page to use SetFocus() or
> the Focus property.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information ab
out
> the error and where it originated in the code.
> Exception Details: System.InvalidOperationException: A form tag with
> runat=server must exist on the Page to use SetFocus() or the Focus propert
y.
> Source Error:
> Line 19: protected void WizardStep1_Activate(object sender, EventArgs
e)
> Line 20: {
> Line 21: TextBox1.Focus();
> Line 22:
> Line 23: }
>
> Source File:
> E:\DevelopmentWebsite\IntranetDev\Portal
\Testing\MultiViewTest.aspx.cs
> Line: 21
> Stack Trace:
> [InvalidOperationException: A form tag with runat=server must exist on the
> Page to use SetFocus() or the Focus property.]
> System.Web.UI.Page.SetFocus(Control control) +2021658
> System.Web.UI.Control.Focus() +20
> Testing_MultiViewTest.WizardStep1_Activate(Object sender, EventArgs e)
in
> E:\DevelopmentWebsite\IntranetDev\Portal
\Testing\MultiViewTest.aspx.cs:21
> System.Web.UI.WebControls.View.OnActivate(EventArgs e) +105
> System.Web.UI.WebControls.MultiView.set_ActiveViewIndex(Int32 value) +3
95
> System.Web.UI.WebControls.MultiView.OnInit(EventArgs e) +46
> System.Web.UI.Control.InitRecursive(Control namingContainer) +321
> System.Web.UI.Control.AddedControl(Control control, Int32 index) +20652
79
> System.Web.UI.ControlCollection.Add(Control child) +146
> System.Web.UI.WebControls.Wizard.CreateControlHierarchy() +2992
> System.Web.UI.WebControls.Wizard.CreateChildControls() +126
> System.Web.UI.Control.EnsureChildControls() +87
> System.Web.UI.WebControls.Wizard.OnInit(EventArgs e) +100
> System.Web.UI.Control.InitRecursive(Control namingContainer) +321
> System.Web.UI.Control.InitRecursive(Control namingContainer) +198
> System.Web.UI.Control.InitRecursive(Control namingContainer) +198
> System.Web.UI.Control.InitRecursive(Control namingContainer) +198
> System.Web.UI.Control.InitRecursive(Control namingContainer) +198
> System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +692
>