Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
following is my code to bind gridview ,I had successfully Binded it with checkbox but now am not able to get checkbox change event of checkbox which is in the grid ,ahead i want to do calculation of 2 column in 3rd column of selected row.


XML
$.ajax({
                    type: "POST",
                    url: "frmInvoice.aspx/LoadWithPOGrid",
                    data: {},//"{ Param1: '" + PonoPos.toString() + "'}",
                    contentType: "application/json",
                    dataType: "json",
                    success: function (data) {
                        debugger;
                        if ($.trim(data.d[0].PoNo) != "") {
                            $($("#<%=gvWithPO.ClientID%>")).empty();
                            $($("#<%=gvWithPO.ClientID%>")).append('<tr><th Style="width:15px" Width="15px"></th> <th>PO No</th><th>PO Line Item No</th><th>Item Code</th><th>Item Description</th><th>Delivery Date</th><th>Delivery Qty</th><th>Qty</th><th>Rate</th><th>Total</th></tr>');
                            for (var i = 0; i < data.d.length; i++) {
                                debugger;
                                var $qty = $.trim(data.d[i].Qty);
                                var $rate = $.trim(data.d[i].Rate);
                                var $tbl = '<tr> <td Style="width:15px" Width="15px">' + '' +
                                           '<input type="checkbox" id="chkRow" class="chkRow" runat="server"  />' +
                                           '' +
                                            '</td><td>' + $.trim(data.d[i].PoNo) +
                                            '</td><td>' + $.trim(data.d[i].PoLineItemNo )+
                                            '</td><td>' + $.trim(data.d[i].Item_Code) +
                                            '</td><td>' + $.trim(data.d[i].Item_Description) +
                                            '</td><td>' + $.trim(data.d[i].Delivered_Date) +
                                            '</td><td>' + $.trim(data.d[i].Delivered_Qty) +
                                            '</td><td> <input type="text" id="txtQty" class="txtQty" maxlength="10" placeholder="Qty" runat="server" readonly="readonly" style="text-align: right;width: 90%"  />' +
                                            '</td><td> <input type="text" id="txtRate" class="txtRate" maxlength="10" placeholder="Rate" runat="server" readonly="readonly" style="text-align: right;width: 90%"  />' +
                                            '</td><td>' + $.trim(data.d[i].Total) + '</td></tr>';

                                $("#<%=gvWithPO.ClientID%>").append($tbl);
                                $("#<%=gvWithPO.ClientID%> tr:last").find("input[type=text][id*=txtQty]").val($.trim(data.d[i].Qty));
                                $("#<%=gvWithPO.ClientID%> tr:last").find("input[type=text][id*=txtRate]").val($.trim(data.d[i].Rate));
                            }
                        } else {
                            debugger;

                            return false;
                        }
                            },
                     error: function () {
                         alert("Error While fetching With PO grid data");
                     }
                 })//Ajax LoadWithPOgrid
Posted
Comments
Solai Raja 3-Mar-15 2:35am    
it seems you adding the server side control(checkbox/text box). You can't add server side controls from JavaScript sides.
8421441333 6-Mar-15 0:48am    
then How can I manipulate with grid which is designed by client side ?
Solai Raja 6-Mar-15 3:56am    
Need more clarifications.
8421441333 9-Mar-15 9:19am    
1)above grid which i binded from client side as shown in above code ,how can i access values of that grid at server side ,
2)OK, if i can not access it from Server side then WHY cant not take checkbox change event at client side in jQuery only ?
Solai Raja 10-Mar-15 1:19am    
$(".chkRow").on("change",function(){
//Code
});

try this for check box change event!.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900