Validating Datagrid values

Results 1 to 2 of 2

Thread: Validating Datagrid values

  1. #1
    Join Date
    Dec 1969

    Default Validating Datagrid values

    I&#039;m trying to validate a datagrid control - when users try to edit cells and the Update so:<BR><BR>// update command called<BR>TextBox user = (TextBox) e.Item.Cells[4].Controls[0];<BR><BR>string user1 = user.Text;<BR><BR>if ( user1 == "" ) // also tried user1.Length &#060; 1<BR>{<BR> lblResponse.Text = "User cannot be blank!";<BR> Cancel_Grid(sender,e);<BR>}<BR><BR>private void Cancel_Grid(object sender,DataGridCommandEventArgs e)<BR>{<BR> grdTasks.EditItemIndex = -1;<BR> BindGrid();<BR>}<BR><BR>But this code is not calling the Cancel_Grid procedure. <BR>Any ideas why?<BR><BR>Thanks!

  2. #2
    Join Date
    Dec 1969

    Default RE: Validating Datagrid values

    Because Cancel_Grid is an EventHandler.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts