在向GridView添加新行时,自动计算列值并将所选项目保留在DDL中 [英] Automatic calculation of column value and retaining the selected item in DDL on addition of new row to GridView

查看:63
本文介绍了在向GridView添加新行时,自动计算列值并将所选项目保留在DDL中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个AJAX选项卡容器,在其中,在PersonDays选项卡上有两个问题:
1:
正如您可以从下面给出的图像中看到的那样,在单击添加"后创建新行时,在DDL中为ResourceType选择的项目值已被更改为DDL的默认值/第一值. 按钮.
(未从数据库表中获取DDL的项目.)
在单击添加"按钮之前,如何在用户选择的项目上固定值?

2:
如何根据"CostPerDay"(即"No.ofDaysXCostPerDay")的焦点变化自动计算"TotalCost"列中的值***无需单击添加" ***按钮,并同时填写添加新行之前,GridView下方的textBox以及"EstimatedCost"选项卡上的textBox是否存在?
(在我当前的表单状态下,只有在单击添加"按钮后才能计算/填充该表单)

屏幕截图
您可以在此处使用数据库备份脚本找到解决方案文件"

I have an AJAX tab container, inside which on PersonDays tab I have two problems:
1:
As you can view from the below given image that the item value selected in the DDL for ResourceType is getting changed to the default/ 1st value of the DDL while the new row is being created after clicking on "Add" button.
(The DDL''s items are not being fetched from a DB table).
How to fix the value on the item selected by the user before clicking on the "Add" button?

2:
How the value in the "TotalCost" column can be calculated automatically on the change of focus from "CostPerDay", that is "No.ofDaysXCostPerDay" ***without clicking on the "Add"*** button and simultaneously filled up in the textBox present below the GridView and in the textBox present on the "EstimatedCost" tab before addition of the new row?
(In my Current state of form it gets calculated/ filled only after I click on the "Add" button")

Screen shot
"You Can Find the Solution File with DB backup script HERE"

推荐答案

请找到答案:

1.您可以使用viewstate保留DDL的状态.或将它们存储在其他会话变量中.

2.您可以使用焦点更改事件或下拉列表中的selectedindexchanged事件.在这种情况下,您可以在文本框中计算并填充新值.
Please find the answer :

1. You can retain the status of DDL by using viewstates. or storing them in other session variables.

2. you can use Focus change event or selectedindexchanged event of dropdown list. in that event you can calculate and populate the new values in text box.


您是否尝试过可编辑的gridview?

具有值的行将显示为普通行(不带ddl或文本框,仅是ddl中的选择文本).可以使用模板化的胶质进行自动计算.

你怎么说?????
have you tried editable gridview ?

The rows with values will be displayed as normal rows(w/o ddl or textbox just the selection text from ddl) . Use can use a templated coloum for automatic calcuation.

What do you say?????


这篇关于在向GridView添加新行时,自动计算列值并将所选项目保留在DDL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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