CausesValidation of editcommandcolumn

Discussion in 'ASP .Net' started by George Durzi, Feb 12, 2004.

  1. George Durzi

    George Durzi Guest

    I have an editcommandcolumn in my datagrid, as follows.
    <asp:editcommandcolumn ButtonType="LinkButton" UpdateText="Update"
    CancelText="Cancel" EditText="Edit">

    I'd like to set the CausesValidation property of the Update portion to
    false. Can't seem to get it to work. The Edit and Cancel linkbuttons have
    CausesValidation turned off by default.

    That cell in that row of my datagrid is being rendered in my trace, as
    follows
    dgCAReminders:_ctl3:_ctl1 System.Web.UI.WebControls.DataGridLinkButton

    When I click Edit, two linkbuttons are rendered:
    dgCAReminders:_ctl3:_ctl1 System.Web.UI.WebControls.DataGridLinkButton
    dgCAReminders:_ctl3:_ctl5 System.Web.UI.LiteralControl
    dgCAReminders:_ctl3:_ctl2 System.Web.UI.WebControls.DataGridLinkButton

    I tried doing something in the OnItemCreated of the datagrid: (The
    editcommandcolumn is in cell 1)
    ((LinkButton)e.Item.Cells[1].Controls[0]).CausesValidation = false;

    But after looking at the trace, I realized that it doesn't make sense coz
    the update linkbutton hasn't been rendered.

    So I moved the above code to the OnEditCommand event, but I got the same
    result.

    What am I missing?
     
    George Durzi, Feb 12, 2004
    #1
    1. Advertising

  2. George Durzi

    George Durzi Guest

    if (e.Item.ItemType == ListItemType.EditItem)

    {

    ((LinkButton) e.Item.Cells[1].Controls[0]).CausesValidation = false;

    }

    I forgot to check within the EditItem

    "George Durzi" <> wrote in message
    news:elQtz$...
    > I have an editcommandcolumn in my datagrid, as follows.
    > <asp:editcommandcolumn ButtonType="LinkButton" UpdateText="Update"
    > CancelText="Cancel" EditText="Edit">
    >
    > I'd like to set the CausesValidation property of the Update portion to
    > false. Can't seem to get it to work. The Edit and Cancel linkbuttons have
    > CausesValidation turned off by default.
    >
    > That cell in that row of my datagrid is being rendered in my trace, as
    > follows
    > dgCAReminders:_ctl3:_ctl1 System.Web.UI.WebControls.DataGridLinkButton
    >
    > When I click Edit, two linkbuttons are rendered:
    > dgCAReminders:_ctl3:_ctl1 System.Web.UI.WebControls.DataGridLinkButton
    > dgCAReminders:_ctl3:_ctl5 System.Web.UI.LiteralControl
    > dgCAReminders:_ctl3:_ctl2 System.Web.UI.WebControls.DataGridLinkButton
    >
    > I tried doing something in the OnItemCreated of the datagrid: (The
    > editcommandcolumn is in cell 1)
    > ((LinkButton)e.Item.Cells[1].Controls[0]).CausesValidation = false;
    >
    > But after looking at the trace, I realized that it doesn't make sense coz
    > the update linkbutton hasn't been rendered.
    >
    > So I moved the above code to the OnEditCommand event, but I got the same
    > result.
    >
    > What am I missing?
    >
    >
     
    George Durzi, Feb 12, 2004
    #2
    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. Josh Anderson - remove Zs to reply

    CausesValidation not taking in Repeater control

    Josh Anderson - remove Zs to reply, Nov 20, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    375
    Josh Anderson - remove Zs to reply
    Nov 20, 2003
  2. z. f.
    Replies:
    4
    Views:
    1,356
    z. f.
    Jun 23, 2004
  3. z. f.
    Replies:
    4
    Views:
    2,265
    Peter Blum
    Jun 25, 2004
  4. Martin
    Replies:
    3
    Views:
    774
    Peter Blum
    May 21, 2005
  5. dustbort
    Replies:
    2
    Views:
    2,856
    dustbort
    Feb 28, 2006
Loading...

Share This Page