在datagrid中单击“编辑"按钮时如何增加DataGrid文本框的大小. [英] how to Increase the DataGrid textbox size when edit button is clicked within datagrid.

查看:79
本文介绍了在datagrid中单击“编辑"按钮时如何增加DataGrid文本框的大小.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在一个有数据网格的项目上工作,这个数据网格上有1个删除按钮和1个编辑按钮. br/> 我的问题是,此datagrid文本框不够宽,无法查看文本框内的整行,因此我想在用户单击编辑"按钮后增加此文本框.

请同样帮我.


i am working on a project which has a datagrid,wihtin this datagrid i have 1 delete button and 1 edit botton.After clicking edit the text within the datagrid becomes available for editing Like a textbox wherein user can update or edit the existing record.
My problem is that this datagrid textbox is not wide enough to view entire line within the textbox hence i want to increase this textbox after user clicks on Edit button.

kindly help me for the same.

推荐答案

编辑项目模板中的

in the Edit Item Template

<EditItemTemplate>
 <asp:TextBox ID="txtId" runat="server" Width="80%" Height="50%"></asp:TextBox> </EditItemTemplate>



给出所需的宽度和高度

或如果您在gridview之外具有编辑"按钮.

在Gridview和
中找到Txtbox控件
Txtbox.width ="As Required";



give the width and height as Required

or If You have Edit button outside of gridview then.

find that Txtbox control in Gridview and

Txtbox.width="As Required";


您可以添加上面文章中提到的宽度和高度.但是,按照最佳做法,您应该使用CSS而不是静态的hight/width尺寸.

1.创建一个具有所需高度和宽度的CSS类
2.在文本框中应用该CSS.您还可以将相同的CSS用于其他页面/其他DataGrid.
3.现在,将来如果您需要再次更改文本框的大小,则只需在CSS文件中更改它,而无需在整个项目中进行更改.

有关CSS和示例的更多详细信息,请单击此处 [
You can add width and height as mentioned in the above post. However as per the best practices, you should use CSS rather then static hight/width dimension.

1. Create a CSS class with required height and weidth
2. Apply that CSS in textbox. You can also re-use the same CSS for other pages/other DataGrid also.
3. Now in future if you need to change the textbox size again, then you only need to change it in CSS file and not in whole project.

For more details regarding CSS and examples please click here[^]


这篇关于在datagrid中单击“编辑"按钮时如何增加DataGrid文本框的大小.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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