validate input in datagrid

Discussion in 'ASP .Net' started by Guest, May 13, 2004.

  1. Guest

    Guest Guest

    Hell

    My problem is that I do not know how to validate input that I let the user type into my datagrid
    In one grid I let the user to type in a value into a template column - how do I make sure that this input is an integer on the client sid
    In a diffrent grid I have an edit command column and the same problem - how do I make sure that this is an integer on the client sid

    Any suggestion
     
    Guest, May 13, 2004
    #1
    1. Advertisements

  2. Guest

    avnrao Guest

    you access the table created by the datagrid. loop thru the elements and
    access it.
    write a javascript like follows..

    // to access the rows in the table
    var iRows = document.all("tablename").rows;
    var oCell;
    var columnNumber = 0; // your column number in which the control to validate
    exists.
    for(var iIndex=1; iIndex < iRows.length; iIndex++)
    {
    oCell = iRows[iIndex].cells[columnNumber];
    alert(oCell.all[indextoyourcontrol]); // check and get the index for
    your control to validate.
    }

    hth,
    Av.
     
    avnrao, May 13, 2004
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.