Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1253
bind grid using javascript
posted

Hi,

In my cshtml, I have this code:

<

 

 

table id="grid1"></table>

I want to use javascript to bind the grid:

 

 

 

 

 

 

 

 

 

 

 

 

<

 

 

script type="text/javascript">

$(

 

 

function () {$('#grid1').show();

$('#DistID').change(function () {

 

 

 

 

 

var selectedId = $(this).val();

 

 

 

var dSource = $.getJSON('@Url.Action("GetAccountList")', { ID: selectedDistId });

autoGenerateColumns:

 

false,

$(

 

'#grid1').igGrid({

columns: [

{ headerText:

 

 

"Order Number", Key: "OrderId", dataType: "number"

}

],

width:

 

'500px',

dataSource: dSource

});

});

});

 

 

 

</script>

And this is my Json data:

[{\"OrderId\" : \"300210\"},{\"OrderId\" : \"300140\"}

I don't why the grid does not display any data.  Am I missing something?  Can you please help me?  Thanks!

 

 

 

Parents Reply Children
No Data