Skip to Content

How to suppress a Click Event for a Check box if it is on a parent line?

Hi,

I am working with VB.NET on a collapsible grid.

The picture below shows my grid as expanded. The grid has one column of Check boxes, and grouping is by "Ship".

When I click on a WHITE check box, this fires a Click Event and a function inserts a calculated number in the "Seq" column.

So far, so good!

But I have noticed that if I accidentally click on a GRAY Check box (which lies on the Parent Line), this freezes the program, because the function is not intended to be used this way.

How can we prevent the Click Event to fire if we click on a GRAY Check box?

If you need further information, I shall be pleased to send.

Thanks

Leon Lai

---------------

Capture.JPG (78.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 30, 2014 at 08:01 AM

    Hi Leon,

    There are many ways to check if this is a parent.

    One way is

    Inside your click event handler

    If oGrid.GetDataTableRowIndex(pVal.Row)<0 Then

         'This is not a leaf

         return

    End If

    You can try other way like :

    oGrid.Rows.isLeaf(pval.row)

    or recursively check for the oGrid.Rows.GetParent(iRow) method.

    Regards
    Edy

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 30, 2014 at 07:22 AM

    hi.

    why don't u use if condition.

    before clicking on the  check box.

    i seen from your attachment that.

    where ever parent line is there doctotal column should be empty..

    but child is having some amount

    u can use it.

    if doctotal>0.0 then

    ''apply your code...

    end if

    and also ship...column

    at parent only having value

    child is not having value am correct.

    if ship="" then

    ''apply your code...

    end if

    Add comment
    10|10000 characters needed characters exceeded

    • Hi $riniva$

      Thanks a lot for your reply.

      I tried your suggestion.

      I put an IF to run my function only when "DocType" = "GRPO"

      Unfortunately, it does not work. Apparently, SDK does not recognize the Parent Row as a Grid Row.

      When I click the check box on the Parent Row, this error message pops up.

      I think we must find a solution in terms of "leaf"

      Best Regards,

      Leon Lai

      Capture.JPG (98.0 kB)