Reputation: 2295
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
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
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
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