Input validation on detailsview

G

Guest

Hi!

I have a detailsview control in a webpart with some templated fields on. I
set the ValidationGroup property to som value on these fields to distinguish
from other web parts on the page. However, I'm not able to set the same
ValidationGroup on the submit controls on the detailsview. Those
linkbuttons(update, insert) are auto generated now.

1. Is it possible to set ValidationGroup on the detailsview?
2. How would I go about implementing the linkbuttons myself? Could you
please provide an example. Want the same functionality as the build in
linkbuttons give me.
3. Any other way (best practice)?

Thanks in advance.

Kjelli
 
G

Guest

Can you please provide some more details?
The detailsview is already using templates for the fields (ItemTemplate and
EditItemTemplate based on IBindableTemplate).

If I set AutoGenerateInsertButton = false, and create my own button with
CommandName = "New", wouldn't the detailsview provide the Insert (without
ValidationGroup property set) and Cancel buttons for me? I don't see how I
can replace all linkbuttons with my own implementation. I fail to see the
template here.

Code sample?

Thanks for your reply by the way


!
 
B

Brock Allen

Something like this:

<asp:DetailsView runat="server" ..... >
<Fields>
<asp:TemplateField>
<ItemTemplate>
<asp:Button runat="server" Text="Edit" CommandName="Edit" />
</ItemTemplate>
<EditItemTemplate>
<asp:Button runat="server" Text="Update" CommandName="Update"
ValidationGroup="YourValGroup" />
<asp:Button runat="server" Text="Cancel" CommandName="Cancel"
/>
</EditItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
 
G

Guest

Thank you Allen! Worked like a charm!

Brock Allen said:
Something like this:

<asp:DetailsView runat="server" ..... >
<Fields>
<asp:TemplateField>
<ItemTemplate>
<asp:Button runat="server" Text="Edit" CommandName="Edit" />
</ItemTemplate>
<EditItemTemplate>
<asp:Button runat="server" Text="Update" CommandName="Update"
ValidationGroup="YourValGroup" />
<asp:Button runat="server" Text="Cancel" CommandName="Cancel"
/>
</EditItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top