CausesValidation of editcommandcolumn

G

George Durzi

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?
 
G

George Durzi

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

{

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

}

I forgot to check within the EditItem
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top