maskMoney Jquery on Gridview

Asked

Viewed 61 times

0

Guys I need to make a coin mask using Maskmoney where the Textbox comes from a dynamically generated Gridview or I don’t know how many lines there are in it. I’m doing it this way but it only works with Gridview’s first line. Like I do so that he considers all the lines and not only the first?

            <script>
                $(function () {
                    $('#ctl00_c_area_conteudo_grd_fornecedor_lance_ctl02_txtVL_Lance').maskMoney(
                        {
                            allowNegative: false,
                            thousands: '.',
                            decimal: ',',
                            affixesStay: false,
                            symbol: "R$",
                            precision: 4

                        }


                        );
                })

1 answer

0

Ah I’ve solved simple

var gvDrv = Document.getElementById("<%= grd_supplier.Clientid %>"); for (i = 1; i < gvDrv.rows.length; i++) {

                        $('#ctl00_c_area_conteudo_grd_fornecedor_lance_ctl0' + i.toString() +'_txtVL_Lance').maskMoney(
                            {
                                allowNegative: false,
                                thousands: '.',
                                decimal: ',',
                                affixesStay: false,
                                symbol: "R$",
                                precision: 4

                            }


                            );

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.