Gridview行由javascript添加。 [英] Gridview row added by javascript.

查看:65
本文介绍了Gridview行由javascript添加。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由gridview构成的弹出窗口.Gridview由默认的3行组成。每个行的gridview都有很少的文本框和下拉列表以及文件上传控件。一个文本框用于付款,一个用于余额。当我付款时,余额得到计算。首先,我将弹出窗口置于更新面板中,并在支付文本框的textchange事件中为gridview动态创建行,它正在工作,但它提供了文件上载和下载的问题。所以,我在下拉列表更改事件中通过javascript创建了gridveiw的行。但是由javascript创建的行可以在后面的代码中找到。

如何解决问题。我需要动态添加行而不回发并支持文件上传和下载。

I have a pop up which consist of gridview.Gridview consist of default 3 rows.The gridview each row has few textboxes and drop down list and file upload control. one textbox is for payment and one for balance. when i pay , balance get calculated. First, i placed the pop up in update panel and dynamically created row for gridview in textchange event of payment textbox,It's working but it gave problem wiht file upload and down load. So, i created the rows for gridveiw by javascript on drop down list change event. But row created by javascript are available in code behind.
How to solve the problem. I need the rows to be added dynamically without post back and also supporting file upload and download.

推荐答案

您的动态添加行而不回发的请求是只是自相矛盾。你用Javascript做什么(以及使用jQuery以最方便的方式完成)只发生在客户端。从ASP.NET应用程序的角度来看,它是服务器端(代码隐藏),您新行根本就不存在。那么,你会期待什么?



在从客户端发送一些HTTP请求之前,服务器端没有任何事情发生。其中一种方法是直接使用Ajax:

http:// en。 wikipedia.org/wiki/Ajax_%28programming%29 [ ^ ],

http://www.xul.fr/ en-xml-ajax.html [ ^ ]。



使用Ajax的一种便捷方式是jQuery Ajax: http://api.jquery.com/jQuery.ajax [ ^ ]。



如果您需要学习jQuery(强烈推荐),请参阅:

< a href =http://en.wikipedia.org/wiki/JQuery> http://en.wikipedia.org/wiki/JQuery [ ^ ],

http://jquery.com [ ^ ],

http://learn.jquery.com [ ^ ],

http://learn.jquery.com/using-jquery-core [ ^ ],

http://learn.jquery.com/about-jquery/how-jquery-works [ ^ ](从这里开始)。



-SA
Your request for "rows to be added dynamically without post back" is simply self-contradictory. What you do with Javascript (and which can be done in a most convenient way using jQuery) happens only on the client side. From the standpoint of the ASP.NET application, it's server side (code behind), you new rows simply do not exist. So, what would you expect?

Nothing happens on the server side before you send some HTTP request from the client side. One of the way to do it directly is using Ajax:
http://en.wikipedia.org/wiki/Ajax_%28programming%29[^],
http://www.xul.fr/en-xml-ajax.html[^].

And just one of the convenient ways of using Ajax is the jQuery Ajax: http://api.jquery.com/jQuery.ajax[^].

If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com[^],
http://learn.jquery.com[^],
http://learn.jquery.com/using-jquery-core[^],
http://learn.jquery.com/about-jquery/how-jquery-works[^] (start from here).

—SA


这篇关于Gridview行由javascript添加。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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