set Attribute from client side doesn't work on server side

1 posts, 0 answers
  1. Hardik
    Hardik avatar
    8 posts
    Member since:
    Jan 2017

    Posted 26 Sep 2017 Link to this post

    I am setting custom attributes value from client side in batch edit event like this:

                   
    ///below function call when grid go to edit mode to view mode and below code for set from list box value to grid cell value.
                   function GetEditorValue(sender, args) {
                       debugger;
                       if ($(args.get_cell()).find(".RadListBox").length > 0) {
                           var lb = $find($(args.get_cell()).find(".RadListBox").attr("id"));
                           var item = lb.get_selectedItem();
                           if (item != null) {
                               args.set_cancel(true);
                               args.set_value(item.get_text());
                               var cell = args.get_cell();
                               cell.setAttribute("searchboxresult", item.get_value());
                               //args.set_value(item.get_value());
                           } else {
                               args.set_cancel(true);
                               args.set_value("");
                           }
                       }
                   }


    Here I have set attribute value of searchboxresult to specific value which you can see here:

    <td searchboxresult="109" style="width:200px;" class="rgSelectedCell  rgBatchChanged">
        <div style="">Headlights - Dual-Beam</div>
    </td>

    Now When I try to access this attribute at my server side on BatchEditCommand like this:

    protected void accoADEGrid_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
    {
                foreach (GridBatchEditingCommand command in e.Commands)
                {
                       var i = command.item.cell[9].Attribute["searchboxresult"].ToString();
                }
    }

     

    I am getting value of i = 0; which is not as per client value and getting unchange value of attribute which is set on ItemDataBound.

Back to Top