如何使asp tablecell在点击时可编辑 [英] How to make asp tablecell editable on click
问题描述
大家好。我的一个网页有一个小问题。我有一个asp.net表,当用户点击/双击单元格时,我需要一些单元格可以编辑,当单元格失去焦点时,输入的数量应该保存到数据库中。任何帮助将不胜感激,请提前感谢。
Hi all. I have a small problem with one of my web pages. I have an asp.net table, i need some of the cells to become editable when a user clicks/double clicks on a cell, and when the cell loses focus the entered amount should be saved to the database. Any help will be much appreciated, thanking you in advance.
推荐答案
我的建议是,
您希望将哪些字段设置为可编辑,将文本框本身放在那里并禁用它们以避免编辑,然后使用css,您可以使其看起来像普通标签。
将两个javascript事件onfocus和onblur绑定到文本框。
onfocus使文本框可编辑并应用不同的风格,使用户觉得它是文本框:)。
onblur从文本框中获取值,使用ajax调用或pagemethod技术调用codebehind方法并保存。
多数民众赞成所有可行的。要了解有关调用代码隐藏方法的更多信息,请查看此链接 http:/ /witstuner.blogspot.in/2013/02/different-ways-of-ajax-call-in-asp.html [ ^ ]
如何使asp tablecell在点击时可编辑
How to make asp tablecell editable on click
为什么不使用Gridview / Listview?使用gridview / Listview有什么问题吗?
最好还是这样。在rowclick事件上调用一个函数并使其处于编辑模式。
--Amit
Why not using Gridview/Listview? Is there any problem in using gridview/Listview?
Better to go with that. Call a function on rowclick event and make it in edit mode.
--Amit
这篇关于如何使asp tablecell在点击时可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!