0

I have a grid view that can edit data, which is bound to an sqldatasource.

However, there are some text boxes in edit mode which I would like to validate. For example, one of the is required and cannot be left empty. How can I make such validation in edit mode in a grid view using javascript?

function ValidateGridEditMode()
{
var Grid = document.getElementById('gridview.clientid');

  //how can i get textboxes and apply validation
}
1
  • how have you bound your gridview? please show some markup. Commented Sep 26, 2012 at 4:06

1 Answer 1

1

Convert those columns into Template columns, and in the ItemTemplate, add a standard Validation control. Ensure that the EnableClientScript is set to true on the validation control.

There is a similar (but not exact duplicate) post here that gives a code sample in a valid answer.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.