Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > detailsview cannot be validated

Reply
Thread Tools

detailsview cannot be validated

 
 
Vincent
Guest
Posts: n/a
 
      02-19-2008
Hi,

i created a detailsview in insert mode. In order to avoid that an user
inserts nothing, i added a RequiredFieldValidator control.

But i get this error:
"Control 'DetailsView1' referenced by the ControlToValidate property of
'RequiredFieldValidator1' cannot be validated"

Why and how to avoid wrong (empty) input?
Thanks
Vincent

<aspetailsView ID="DetailsView1" runat="server" DefaultMode="Insert">
<Fields>
<asp:BoundField DataField="groepnr" HeaderText="groepnr"
InsertVisible="False"
ReadOnly="True" SortExpression="groepnr" />
<asp:BoundField DataField="groepna" HeaderText="groepna"
SortExpression="groepna" />
<asp:BoundField DataField="kleur" HeaderText="kleur"
SortExpression="kleur" />
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True"
ShowInsertButton="True" />
</Fields>
</aspetailsView>

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="DetailsView1"></asp:RequiredFieldValidator>


 
Reply With Quote
 
 
 
 
Manish
Guest
Posts: n/a
 
      02-20-2008
Hi Vincent,

You would need to use a TemplateField instead of boundField and put the
Textbox control in the ItemTemplate of that templatefield and also put a
requiredFieldValidator and set the controltoValidate property to the Textbox
control.

Also bind the Textbox control to the field in the table.

Regards,
Manish
www.ComponentOne.com


"Vincent" wrote:

> Hi,
>
> i created a detailsview in insert mode. In order to avoid that an user
> inserts nothing, i added a RequiredFieldValidator control.
>
> But i get this error:
> "Control 'DetailsView1' referenced by the ControlToValidate property of
> 'RequiredFieldValidator1' cannot be validated"
>
> Why and how to avoid wrong (empty) input?
> Thanks
> Vincent
>
> <aspetailsView ID="DetailsView1" runat="server" DefaultMode="Insert">
> <Fields>
> <asp:BoundField DataField="groepnr" HeaderText="groepnr"
> InsertVisible="False"
> ReadOnly="True" SortExpression="groepnr" />
> <asp:BoundField DataField="groepna" HeaderText="groepna"
> SortExpression="groepna" />
> <asp:BoundField DataField="kleur" HeaderText="kleur"
> SortExpression="kleur" />
> <asp:CommandField ShowDeleteButton="True"
> ShowEditButton="True"
> ShowInsertButton="True" />
> </Fields>
> </aspetailsView>
>
> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
> ControlToValidate="DetailsView1"></asp:RequiredFieldValidator>
>
>
>

 
Reply With Quote
 
 
 
 
Vincent
Guest
Posts: n/a
 
      02-20-2008
thanks

"Manish" <> schreef in bericht
news9CC0033-F97C-49B1-AC9D-...
> Hi Vincent,
>
> You would need to use a TemplateField instead of boundField and put the
> Textbox control in the ItemTemplate of that templatefield and also put a
> requiredFieldValidator and set the controltoValidate property to the
> Textbox
> control.
>
> Also bind the Textbox control to the field in the table.
>
> Regards,
> Manish
> www.ComponentOne.com
>
>
> "Vincent" wrote:
>
>> Hi,
>>
>> i created a detailsview in insert mode. In order to avoid that an user
>> inserts nothing, i added a RequiredFieldValidator control.
>>
>> But i get this error:
>> "Control 'DetailsView1' referenced by the ControlToValidate property of
>> 'RequiredFieldValidator1' cannot be validated"
>>
>> Why and how to avoid wrong (empty) input?
>> Thanks
>> Vincent
>>
>> <aspetailsView ID="DetailsView1" runat="server" DefaultMode="Insert">
>> <Fields>
>> <asp:BoundField DataField="groepnr" HeaderText="groepnr"
>> InsertVisible="False"
>> ReadOnly="True" SortExpression="groepnr" />
>> <asp:BoundField DataField="groepna" HeaderText="groepna"
>> SortExpression="groepna" />
>> <asp:BoundField DataField="kleur" HeaderText="kleur"
>> SortExpression="kleur" />
>> <asp:CommandField ShowDeleteButton="True"
>> ShowEditButton="True"
>> ShowInsertButton="True" />
>> </Fields>
>> </aspetailsView>
>>
>> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
>> ControlToValidate="DetailsView1"></asp:RequiredFieldValidator>
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DetailsView - Changing to Insert Mode (Not By Using the Insert Button In the DetailsView Control) Feege ASP .Net Web Controls 0 12-20-2005 12:28 AM
"Cannot be validated" - why not??? Owen ASP .Net 1 09-12-2005 09:23 PM
Highlight Required Field When Not Validated Steve Murphy ASP .Net 5 08-02-2005 09:13 PM
ASP.net validation controls don't are not validated(fired) on the client side. mallik ASP .Net 3 07-07-2005 08:42 AM
dynamically created control is not being validated DesignerX ASP .Net 2 07-24-2003 04:47 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57