当我点击编辑按钮时,Gridview会改变大小,原因是什么? [英] Gridview changes the size when I Clicks the edit button , What will be the reason?

查看:107
本文介绍了当我点击编辑按钮时,Gridview会改变大小,原因是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编辑数据库中的值但Gridview会在我更新数据时再次单击编辑按钮时更改大小,它会缩小为原始大小吗?这个问题的解决方案是什么?

Am trying to edit the values in the database but Gridview changes the size when I Clicks the edit button again when I will update the data it will reduced to original size ? What will be the solution for the problem?

推荐答案

我认为这是editmode文本框大小的问题。

试试这个: -

i think it is issue of editmode textboxes sizes.
try this to that:-
protected void RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowState == DataControlRowState.Edit)
    {
        TextBox comments = (TextBox)e.Row.Cells[column_index].Controls[control_index];
        comments.TextMode = TextBoxMode.MultiLine;
        comments.Height = 100;
        comments.Width = 400;
    }
}





或设计中

设置 ItemStyle -Width ControlStyle-Width ,如果你想包装文本,请使用 ItemStyle-Wrap



or in design
Set the ItemStyle-Width and ControlStyle-Width, and if you want wrap the text use ItemStyle-Wrap.


必须适用于您的餐桌的任何CSS。在mozilla中使用chrome或firebug中的Inspect element帮助正确检查。
There must be any css applying to your table. Check properly with the help of "Inspect element" in chrome or firebug in mozilla.


这篇关于当我点击编辑按钮时,Gridview会改变大小,原因是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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