将可编辑控件更改为不可编辑的控件。 [英] Change editable controls to non editable ones.

查看:120
本文介绍了将可编辑控件更改为不可编辑的控件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在asp.net中创建一个gridview,用于将已购买的商品添加到发票帐单中。我在页脚行中添加了按钮以在gridview中添加行。我在按钮外面保存按钮,在gridview中添加所有购买的项目后,我必须单击保存按钮将所有gridview行保存到数据库中。我遇到的最大问题是,在输入详细信息时,gridview列将具有可编辑的控件,如文本框,复选框和下拉列表,单击添加按钮后,所有控件都必须更改为不可编辑的控件,如标签..这是任务给了我,我无法做到,所以请帮助我..

解决方案

在AddButton_Click()事件中尝试将gridview id启用为false。例如,您的gridview id是gridview1,然后在.cs文件中的AddButton_Click()事件中添加以下代码。你可以看到所有可编辑的控件都被禁用为不可编辑的。



 gridview1.Enabled = false; 


I want to create a gridview in asp.net for adding purchased items to the invoice bill. i have add button in the footer row to add rows in the gridview. And i have save button outside the button, after adding all the purchased items inside the gridview i have to click the save button to save all the gridview rows into the DB. The biggest problem i have is, while entering the details the gridview columns will be having editable controls like textbox, checkbox and dropdownlist, after clicking the add button, all the controls has to be changed into non editable controls like label.. This is the task given to me and i couldnt able to do,, so please help me..

解决方案

In AddButton_Click() event try to assign gridview id enabled to false. ie., For example your gridview id is gridview1 then add the following code in AddButton_Click() event in .cs file. You could see all the editable controls are disabled as non-editable.

gridview1.Enabled = false;


这篇关于将可编辑控件更改为不可编辑的控件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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