Option 1) You could turn item into a template field and add validation controls.
Option 2) In your Item_Inserting Function you can capture bound fields as follows. This code would stop a blank field in row 1 from being inserted.
ProtectedSub DetailsView1_ItemInserting(ByVal senderAsObject,ByVal eAs System.Web.UI.WebControls.DetailsViewInsertEventArgs)Handles DetailsView1.ItemInserting If e.Values(0).ToString =NothingThen 'Change the 0 to the row you want to capture 'Display Error Messagee.Cancel =
True'This cancels the insert EndIfEndSubThanks, getdotnethelp. That worked like a charm
No comments:
Post a Comment