Input validation on detailsview

Discussion in 'ASP .Net' started by =?Utf-8?B?S2plbGwgQXJuZQ==?=, Jun 1, 2006.

  1. 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
    =?Utf-8?B?S2plbGwgQXJuZQ==?=, Jun 1, 2006
    #1
    1. Advertising

  2. 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


    !
    "Brock Allen" wrote:

    > You can provide a template for the buttons and as long as you assign well-known
    > CommandName properties to the Button's then they'll behavor the same. The
    > well-known values are: "Edit", "Update", "Cancel", "Delete" and "New", IIRC.
    >
    > -Brock
    > http://staff.develop.com/ballen
    >
    >
    > > 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
    > >

    >
    >
    >
    =?Utf-8?B?S2plbGwgQXJuZQ==?=, Jun 2, 2006
    #2
    1. Advertising

  3. =?Utf-8?B?S2plbGwgQXJuZQ==?=

    Brock Allen Guest

    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>

    -Brock
    http://staff.develop.com/ballen


    > 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
    >
    > !
    > "Brock Allen" wrote:
    >> You can provide a template for the buttons and as long as you assign
    >> well-known CommandName properties to the Button's then they'll
    >> behavor the same. The well-known values are: "Edit", "Update",
    >> "Cancel", "Delete" and "New", IIRC.
    >>
    >> -Brock
    >> http://staff.develop.com/ballen
    >>> 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
    >>>
    Brock Allen, Jun 2, 2006
    #3
  4. Thank you Allen! Worked like a charm!

    "Brock Allen" wrote:

    > 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>
    >
    > -Brock
    > http://staff.develop.com/ballen
    >
    >
    > > 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
    > >
    > > !
    > > "Brock Allen" wrote:
    > >> You can provide a template for the buttons and as long as you assign
    > >> well-known CommandName properties to the Button's then they'll
    > >> behavor the same. The well-known values are: "Edit", "Update",
    > >> "Cancel", "Delete" and "New", IIRC.
    > >>
    > >> -Brock
    > >> http://staff.develop.com/ballen
    > >>> 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
    > >>>

    >
    >
    >
    =?Utf-8?B?S2plbGwgQXJuZQ==?=, Jun 26, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Cas
    Replies:
    2
    Views:
    683
    André
    Oct 20, 2006
  2. Cas

    how to validate input of a detailsview?

    Cas, Oct 20, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    793
    André
    Oct 20, 2006
  3. Feege
    Replies:
    0
    Views:
    432
    Feege
    Dec 20, 2005
  4. Alan Morris

    Detailsview control for data input

    Alan Morris, Oct 7, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    115
    Alan Morris
    Oct 8, 2006
  5. Cas

    how to validate input of a detailsview?

    Cas, Oct 20, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    159
    André
    Oct 20, 2006
Loading...

Share This Page