Showing posts with label form. Show all posts
Showing posts with label form. Show all posts

Saturday, March 24, 2012

this should be easy...

really simple.
the DBA gives you a field called txtEntry.
it's an integer field in sql 2000.
make a form that has the txtEntry field and validate that only integers
are passed thru on that
form when you save it.
well, i tried this.
i used the CompareValidator control.
make it to DataTypeCheck to Integer.
it lets thru
9999999999
that is ten 9's.
it shouldn't because an integer's max value is
int
Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 -
1 (2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int
is integer
why does it let this pass thru? am i doing something wrong?
then on top of that
if i try to pass
2,147,483,647 it won't work because it has comma's.
there has to be a better way to do this.
help, thx.Purdy,
Use a range validator instead. With it you can set minimum and maximum
values. It won't allow commas either though. If you really need to allow
commas and check the min/max you'll want to use a regular expression
validator.
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
<purdy_ra@.yahoo.com> wrote in message
news:1137184901.250491.56470@.g14g2000cwa.googlegroups.com...
> really simple.
> the DBA gives you a field called txtEntry.
> it's an integer field in sql 2000.
> make a form that has the txtEntry field and validate that only integers
> are passed thru on that
> form when you save it.
> well, i tried this.
> i used the CompareValidator control.
> make it to DataTypeCheck to Integer.
> it lets thru
> 9999999999
> that is ten 9's.
> it shouldn't because an integer's max value is
> int
> Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 -
> 1 (2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int
> is integer
> why does it let this pass thru? am i doing something wrong?
> then on top of that
> if i try to pass
> 2,147,483,647 it won't work because it has comma's.
> there has to be a better way to do this.
> help, thx.
>

this should be easy...

really simple.
the DBA gives you a field called txtEntry.
it's an integer field in sql 2000.

make a form that has the txtEntry field and validate that only integers
are passed thru on that
form when you save it.

well, i tried this.
i used the CompareValidator control.
make it to DataTypeCheck to Integer.

it lets thru
9999999999
that is ten 9's.
it shouldn't because an integer's max value is

int
Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 -
1 (2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int
is integer

why does it let this pass thru? am i doing something wrong?

then on top of that
if i try to pass
2,147,483,647 it won't work because it has comma's.

there has to be a better way to do this.
help, thx.Purdy,

Use a range validator instead. With it you can set minimum and maximum
values. It won't allow commas either though. If you really need to allow
commas and check the min/max you'll want to use a regular expression
validator.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
<purdy_ra@.yahoo.com> wrote in message
news:1137184901.250491.56470@.g14g2000cwa.googlegro ups.com...
> really simple.
> the DBA gives you a field called txtEntry.
> it's an integer field in sql 2000.
> make a form that has the txtEntry field and validate that only integers
> are passed thru on that
> form when you save it.
> well, i tried this.
> i used the CompareValidator control.
> make it to DataTypeCheck to Integer.
> it lets thru
> 9999999999
> that is ten 9's.
> it shouldn't because an integer's max value is
> int
> Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 -
> 1 (2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int
> is integer
> why does it let this pass thru? am i doing something wrong?
> then on top of that
> if i try to pass
> 2,147,483,647 it won't work because it has comma's.
> there has to be a better way to do this.
> help, thx.

this.Controls.Add(ImageButton[i]) exception

Hi CJ,
If you add ImageButton to form rather than page, the
ImageButton will be placed inside form tag:
HtmlForm form = (HtmlForm)this.FindControl("Form1");
//...
form.Controls.Add(ImageArray[i]);
//...
Hope it's helpful to you.
Elton Wang
elton_wang@dotnet.itags.org.hotmail.com

>--Original Message--
>Morning -
>I am hoping somebody from this group can help me out
here...
>I have been trying to add an array of ImageButtons to my
WebForm however I
>keep getting an exception that I can't seem to find an
answer for any where
>on the net.
>Any help in the right direction would be greatly
appreciated. If more
>code/source is need please let me know and I will post
more.
>thx -
>CJ
><!-- Code here>
>...
>ImageButton [] ImageArray = new ImageButton
[FileName.Length];
>...
>for (int i = 0; i < FileName.Length; i++)
> {
> ImageArray[i]= new ImageButton();
> ...
> this.Controls.Add(ImageArray[i]);
> }
>...
><HTML>
>...
> <FORM id="display" method="post" runat="server">
> ...
> </FORM>
></HTML>
>Exception Details: System.Web.HttpException:
Control 'Preview1' of type
>'ImageButton' must be placed inside a form tag with
runat=server.
>Stack Trace:
>
>[HttpException (0x80004005): Control 'Preview1' of
type 'ImageButton' must
>be placed inside a form tag with runat=server.]
> System.Web.UI.Page.VerifyRenderingInServerForm(Control
control)
>
System.Web.UI.WebControls.ImageButton.AddAttributesToRender
(HtmlTextWriter
>writer)
> System.Web.UI.WebControls.WebControl.RenderBeginTag
(HtmlTextWriter
>writer)
> System.Web.UI.WebControls.WebControl.Render
(HtmlTextWriter writer)
> System.Web.UI.Control.RenderControl(HtmlTextWriter
writer)
> System.Web.UI.Control.RenderChildren(HtmlTextWriter
writer)
> System.Web.UI.Control.Render(HtmlTextWriter writer)
> System.Web.UI.Control.RenderControl(HtmlTextWriter
writer)
> System.Web.UI.Page.ProcessRequestMain()
><end code -->
>
>.
>Hi,
You need to give some part of the source code and the error description.
Then only we can figure out.
Prakash.C
"Elton Wang" wrote:

> Hi CJ,
> If you add ImageButton to form rather than page, the
> ImageButton will be placed inside form tag:
> HtmlForm form = (HtmlForm)this.FindControl("Form1");
> //...
> form.Controls.Add(ImageArray[i]);
> //...
> Hope it's helpful to you.
> Elton Wang
> elton_wang@.hotmail.com
>
> here...
> WebForm however I
> answer for any where
> appreciated. If more
> more.
> [FileName.Length];
> Control 'Preview1' of type
> runat=server.
> type 'ImageButton' must
> control)
> System.Web.UI.WebControls.ImageButton.AddAttributesToRender
> (HtmlTextWriter
> (HtmlTextWriter
> (HtmlTextWriter writer)
> writer)
> writer)
> writer)
>

Tuesday, March 13, 2012

thread was being aborted

Hi, everyone

I create one application with form authentication.

When I try to run application and press login button it will redirect to default page and application run success fully, some time it will not redirect to default page .

For my application, I have to create one txt log file for error …

Sometime this error occurs when I press login button….

--------------------------

Source Code : mscorlib

Error Message : Thread was being aborted.

Stack Trace : at System.Threading.Thread.AbortInternal()

at System.Threading.Thread.Abort()

at System.Threading.Thread.Abort(Object stateInfo)

at System.Web.HttpResponse.End()

at System.Web.HttpResponse.Redirect(String url, Boolean endResponse)

at System.Web.HttpResponse.Redirect(String url)

at pms._default.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\aspnet\pms\default.aspx.vb:line 104

--------------------------

source code for login button is……

--------------------------

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

Try

singleSqlString = "SELECT emp_code,password,access_level,emp_name " & _

"FROM login_master " & _

"WHERE emp_code='" & txtEmpCode.Text & "' AND password='" & txtPassword.Text & "' " & _

"ORDER BY emp_code ASC"

objlogin.FillDataSet(singleSqlString, "login_master")

If objlogin.dtSet.Tables("login_master").Rows.Count > 0 Then

Session("LoginCode") = txtEmpCode.Text

Session("EmpName") = objlogin.dtSet.Tables("login_master").Rows(0).Item("emp_name")

Session("AccessLevel") = objlogin.dtSet.Tables("login_master").Rows(0).Item("access_level")

FormsAuthentication.RedirectFromLoginPage(txtEmpCode.Text, False)

Else

lblmsg.Text = " Employee Code or Password may be wrong. - Try Again !!"

txtEmpCode.Text = ""

txtPassword.Text = ""

End If

Catch ex As ThreadAbortException

lblmsg.Visible = True

lblmsg.Text = "Thread is aboard"

Catch ex As Exception

objlogin.CreateLogFile(ex, objlogin.Message)

End Try

End Sub

--------------------------

when I trace my application using break point exception is not generated , but error occurs

plz give any solution and cause for this error.

Thanks in advance

Hi,

The error generated appears to be occuring on the default page:

at pms._default.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\aspnet\pms\default.aspx.vb:line 104

Have you checked/debugged the code here to see what's happening?