473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

.net 2.0 credit card validator

Hi

Does anybody know of a credit card validator for .net 2.0?
For .net 1.1 i'm using this great validator:
http://www.codeproject.com/aspnet/cr...dvalidator.asp
But I can't get it to work with masterpages :-(
Eirik
May 29 '06 #1
6 1193
"Eirik Eldorsen" <ku*******@hotmail.com> wrote in message
news:ep**************@TK2MSFTNGP02.phx.gbl...
But I can't get it to work with masterpages :-(


How do you know? What error(s) are you getting?
May 29 '06 #2
The error I get is controltovalidate is null or not an object.

I'm guessing that the control can't find txtCardNr since it's id becomes
ctl00_cphMainContent_txtCardNr when using masterpages. Am I wrong? Have you
used the control with masterpages?
Eirik
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> skrev i melding
news:OF**************@TK2MSFTNGP02.phx.gbl...
"Eirik Eldorsen" <ku*******@hotmail.com> wrote in message
news:ep**************@TK2MSFTNGP02.phx.gbl...
But I can't get it to work with masterpages :-(


How do you know? What error(s) are you getting?

May 29 '06 #3
UPDATE:
The error I recieve: document.all.CreditCardValidator1.controltovalidat e is
null or not an object

This is probably because the masterpage renames CreditCardValidator1 to
ctl00_cphMainContent_CreditCardValidator1
Eirik
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> skrev i melding
news:OF**************@TK2MSFTNGP02.phx.gbl...
"Eirik Eldorsen" <ku*******@hotmail.com> wrote in message
news:ep**************@TK2MSFTNGP02.phx.gbl...
But I can't get it to work with masterpages :-(


How do you know? What error(s) are you getting?

May 29 '06 #4
I've created a workaround:
The thing that is'nt working is the clientscript, so I set the variable:
EnableClientScript="False" on the validator.
Now I only get a serverside check, which works perfect. And since I'm using
Ajax the users won't notice the postback to the server :-D
"Eirik Eldorsen" <ku*******@hotmail.com> skrev i melding
news:%2****************@TK2MSFTNGP05.phx.gbl...
UPDATE:
The error I recieve: document.all.CreditCardValidator1.controltovalidat e
is null or not an object

This is probably because the masterpage renames CreditCardValidator1 to
ctl00_cphMainContent_CreditCardValidator1
Eirik
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> skrev i melding
news:OF**************@TK2MSFTNGP02.phx.gbl...
"Eirik Eldorsen" <ku*******@hotmail.com> wrote in message
news:ep**************@TK2MSFTNGP02.phx.gbl...
But I can't get it to work with masterpages :-(


How do you know? What error(s) are you getting?


May 29 '06 #5
You can use something like the following to ensure "unmangling" of control
names:

private string script = "[Label1ID].innerHTML = 'boo!';";
private string scriptKey = "hello";
private bool addScriptTags = true;
protected void Page_Load(object sender, EventArgs e)
{
script = script.Replace("[Label1ID]",Label1.ClientID);
ClientScript.RegisterStartupScript(this.GetType(), scriptKey, script,
addScriptTags);

.. . .

Peter

Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Eirik Eldorsen" wrote:
UPDATE:
The error I recieve: document.all.CreditCardValidator1.controltovalidat e is
null or not an object

This is probably because the masterpage renames CreditCardValidator1 to
ctl00_cphMainContent_CreditCardValidator1
Eirik
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> skrev i melding
news:OF**************@TK2MSFTNGP02.phx.gbl...
"Eirik Eldorsen" <ku*******@hotmail.com> wrote in message
news:ep**************@TK2MSFTNGP02.phx.gbl...
But I can't get it to work with masterpages :-(


How do you know? What error(s) are you getting?


May 29 '06 #6
Nice trick :-)

But to use this, do I have to rewrite the source of the validator? (i'm only
using a ddl file now)
"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> skrev i melding
news:A5**********************************@microsof t.com...
You can use something like the following to ensure "unmangling" of control
names:

private string script = "[Label1ID].innerHTML = 'boo!';";
private string scriptKey = "hello";
private bool addScriptTags = true;
protected void Page_Load(object sender, EventArgs e)
{
script = script.Replace("[Label1ID]",Label1.ClientID);
ClientScript.RegisterStartupScript(this.GetType(), scriptKey, script,
addScriptTags);

. . .

Peter

Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Eirik Eldorsen" wrote:
UPDATE:
The error I recieve: document.all.CreditCardValidator1.controltovalidat e
is
null or not an object

This is probably because the masterpage renames CreditCardValidator1 to
ctl00_cphMainContent_CreditCardValidator1
Eirik
"Mark Rae" <ma**@markN-O-S-P-A-M.co.uk> skrev i melding
news:OF**************@TK2MSFTNGP02.phx.gbl...
> "Eirik Eldorsen" <ku*******@hotmail.com> wrote in message
> news:ep**************@TK2MSFTNGP02.phx.gbl...
>
>> But I can't get it to work with masterpages :-(
>
> How do you know? What error(s) are you getting?
>


May 29 '06 #7

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

Similar topics

8
by: sam1967 | last post by:
I know how to build forms with ASP and process user input. Now i want to take credit card payments via a form. i will then download the details and process them via our credit card machine. do...
6
by: Simon Wigzell | last post by:
My client wants to have credit card information fields on his forms for his website visitors to be able to buy his wervices by credit card. The credit card info - Brand, number and expiry date will...
10
by: dries | last post by:
A friend of mine has a problem with his credit card validation routine and it is probably a simple thing to solve but I cannot find it. It has to do with the expiry dates. What happens is that as...
4
by: Michelle A. | last post by:
I have a form that takes in a credit card number, just a series of numbers 1234123412341234. When they get to the "Review" page and display all the information a user has entered, I would like the...
6
by: Arne | last post by:
What would be a good component for processing credit cards? (I am not using commerce server.) Would I need to encrypt the credit card column in the database?
4
by: Jerry Camel | last post by:
I'm writing and ASP.net app using vb .net. I need to interact with a credit card reader. I have one that sits inline with the keyboard. Works great, except for the fact that no matter what field...
7
by: Sandy | last post by:
I need a credit card validator. Is there reliable code already written that anyone knows of? I have come across a few things; i.e. the Luhn-10 algorithm, but don't know if that still applies or...
12
by: Jerry Camel | last post by:
Not sure if this is a good place to post this... I'm writing and ASP.net app using vb .net. I need to interact with a credit card reader. I have one that sits inline with the keyboard. Works...
1
by: securedcardss | last post by:
http://card.2youtop.info secured credit card card credit instant secured card cash credit secured card
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
Oralloy
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,...
0
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...

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.