This is a migrated thread and some comments may be shown as answers.

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

0 Answers 189 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hardik
Top achievements
Rank 1
Hardik asked on 26 Sep 2017, 01:03 PM
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.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Hardik
Top achievements
Rank 1
Share this question
or