Joshua
Joshua

Reputation: 2295

How do I check whether the controls in a usercontrol contain any value?

How do I check whether the controls in a usercontrol contain any value?

I have created a usercontrol called ctlCustomerAddress and I want to create an address record in the database if only I have the values in the textboxes.

Upvotes: 0

Views: 68

Answers (3)

Lloyd Powell
Lloyd Powell

Reputation: 18790

Is a RequiredValidator control what you're looking for? MSDN Reference.

You can also use CustomerValidator and RegularExpressionValidator controls.

Set their ValidationGroup properties to be the same as your submit button.

Upvotes: 0

Zo Has
Zo Has

Reputation: 13038

You can use validation controls. Also write the save to DB code to a button inside the user control rather then the parent page ?

Upvotes: 0

KV Prajapati
KV Prajapati

Reputation: 94645

There are number of ways to validate user input. You may use Validation Control (RequiredField), or write JavaScript code or write server side code to validate the user input.

Upvotes: 1

Related Questions