可编辑gridview中的boundfield [英] boundfield in editable gridview

查看:96
本文介绍了可编辑gridview中的boundfield的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可编辑的gridview,我使用项目模板和编辑模板用于声明4列的列和一列的boundfield,我的问题是,无论我点击编辑按钮,有界的项目也变得可编辑(即转换为textbox)是否有任何解决方案可以避免这种情况?我希望boundedfeild保持不可编辑

解决方案

我知道的一种方式是

使用项目模板字段并在编辑项目模板中使用Label来显示您的数据,因此它将处于可编辑模式的读取模式。


使用可编辑的网格视图时避免使用boundfeild(即使您希望以格式化方式显示值,即在我的情况下我想从时间和日期中消除时间段)因为当你单击编辑按钮OnRowEditing事件时,绑定的场也变得可编辑以避免使用模板场并将值绑定到标签,可以通过将文本属性设置为
Text =<%#string.Format({0; d},Eval(Column Name))%>>


使用以下代码将帮助您解决问题。



Text =<%#string.Format({0; d},Eval(Columnname)) %GT;>

i have one editable gridview ,i have use item templete and edit templete for declaring columns for 4 columns and boundfield for one column,my problem is wheever i am clicking edit button the bounded feild item also becomes editable(ie gets converted into textbox) is there any solution to avoid this? i want boundedfeild to remain uneditable

解决方案

One way that i know is
Use Item template field and in edit item template use Label to show your data,so it will be in read mode in editable mode.


while using an editable grid view avoid using boundfeild (even if you want to display value in formated way,ie in my case i wanted to eliminate time section from time and date) because when u click edit button OnRowEditing Event the bound feild also becomes editable to avoid this use templete feilds and bind the value to a label,formating can be done by setting text property as
Text=<%#string.Format("{0;d},Eval("Column Name"))%>>


Use the following code will help you to sort out your problem.

Text=<%#string.Format("{0;d},Eval("Columnname"))%>>


这篇关于可编辑gridview中的boundfield的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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