如何在加载下拉列表后加载webgrid [英] how to load a webgrid after loading dropdown list

查看:102
本文介绍了如何在加载下拉列表后加载webgrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法动态加载webgrid,因为绑定到它的源为null。只有在选择了下拉列表项后才加载数据源,然后在选择更改时,它通过Ajax调用调用ActionResult,然后将html绑定到Webgrid。但是在它运行项目之前,它会抛出一个异常,例如对象引用未设置为对象的实例。 。因为我分配的数据源是空的,只有在选择下拉列表后加载。





我试过把if语句放到检查null,对于webgrid Div,但是在加载值之后,它也没有显示grid.If检查不起作用。



注意:当通过Ajax调用从下拉列表中选择项目时,我通过Ajax调用绑定到网格



成功:功能(结果){

$(#GridTable)。html(结果);

},





任何解决方案?

I am unable to load a webgrid dynamically as the source bound to it is null. the datasource gets loaded only after selecting the dropdownlist item, then on selection change it calls an ActionResult through an Ajax call, then binds the html to the Webgrid. But before it runs the project, it throws an exception like "Object reference not set to an instance of an object." . because the datasource I have assigned is null and loads only after the selection of dropdownlist.


I have tried by putting the If statement for checking null, for the webgrid Div, but after loading the values also, its not showing the grid.If checking is not working.

Note: I am binding to the grid by Ajax call when the item gets selected from the dropdown by Ajax call as

success: function (result) {
$("#GridTable").html(result);
},


Any Solution for this?

推荐答案

(#GridTable)。html(result) ;

},





任何解决方案?
("#GridTable").html(result);
},


Any Solution for this?


这篇关于如何在加载下拉列表后加载webgrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆