Jquery和ASP.net Treeview背后有C#代码 [英] Jquery and ASP.net Treeview with C# code behind

查看:65
本文介绍了Jquery和ASP.net Treeview背后有C#代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



这可能是一个愚蠢的问题,但请帮助我因为我在jQuery中有点天真。



在我的asp.net页面上,我有



所有必要的jQuery库引用

Asp.net treeview

两个组合框

一个asp.net按钮



过程是:当用户点击时按钮,后面的代码利用两个组合框的选定值来调用数据库,然后返回一个数据表,然后在树视图中填充记录。



在正常情况下,按钮点击进行回发,这样可以正常工作。



我正在做的是使用jQuery AJAX调用($ .ajax)来调用与POST方法相同的页面并将组合框值作为查询字符串传递。



一切都发生在后面的代码中,数据库返回所需的记录。代码背后的代码确实执行填充树视图,但是,在前端,这不会在AJAX调用结束时显示。



任何人都可以请一些光?



谢谢。



问候,

Nayan

解决方案

.ajax)使用POST方法调用同一页面并将组合框值作为查询字符串传递。



一切都发生在后面的代码中,数据库返回所需的记录。代码背后的代码确实执行填充树视图,但是,在前端,这不会在AJAX调用结束时显示。



任何人都可以请一些光?



谢谢。



问候,

Nayan

如果您在ajax中手动执行此操作,则必须编写所有客户端代码以使用返回的结果更新您的树视图。一种更简单的方法是使用已经支持ajax的控件或将其包装在可以为您处理它的异步更新面板中。


Hello all experts,

This may be a stupid question but please help me because of me being bit naive in jQuery.

On my asp.net page, I have

All necessary references to jQuery library
Asp.net treeview
Two combo boxes
One asp.net button

The process is: When the user clicks on the button, the code behind utilises the selected value of the two combo boxes to call the database and then return a datatable of which the records will then be populated in the treeview.

In a normal scenario, doing a postback on button click, this works fine.

What I am doing is using jQuery AJAX call ($.ajax) to call the same page with the POST method and passing the combo boxes value as query strings.

Everything happens at the code behind and the database returns the required records. The code behind code does execute populating the treeview, but, in the front end, this is not shown at the end of the AJAX call.

Can anyone please shed some light?

Thanks.

Regards,
Nayan

解决方案

.ajax) to call the same page with the POST method and passing the combo boxes value as query strings.

Everything happens at the code behind and the database returns the required records. The code behind code does execute populating the treeview, but, in the front end, this is not shown at the end of the AJAX call.

Can anyone please shed some light?

Thanks.

Regards,
Nayan


If you do it manually in ajax you'll have to write all the client side code to update your treeview with the results that come back. A much easier approach is to use a control that already supports ajax or wrap it in an asynchronous update panel which can handle it for you.


这篇关于Jquery和ASP.net Treeview背后有C#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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