473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Row / Column gets much bigger when editing a row in grid

Hi there,
What determines the sizes of rows / columns / cells when a grid is in edit
mode ?

When I click the edit command of a row item, the whole grid 'bounces' to a
much larger size... and after update it reduces back again.

I have a custom crafted grid (AutoGenerateColumns = False) ... and can have
not placed any setting that would seem to cause this behaviour.

Is this a default type bahaviour ? How should I work around this such that
disconcerting size changes do not occur ?

thanks,

Bazza
Nov 19 '05 #1
4 1229
"Bazza Formez" <ba**********@paradise.net.nz> wrote in message
news:lM********************@news02.tsnz.net...
Hi there,
What determines the sizes of rows / columns / cells when a grid is in edit
mode ?

When I click the edit command of a row item, the whole grid 'bounces' to a
much larger size... and after update it reduces back again.

I have a custom crafted grid (AutoGenerateColumns = False) ... and can
have not placed any setting that would seem to cause this behaviour.

Is this a default type bahaviour ? How should I work around this such that
disconcerting size changes do not occur ?


Remember that it's all just HTML.

To find the answer, create a simple reproducer. Then, look at the HTML via
View Source befoire you put it into edit mode, and then look again
afterwards.

One thing I've seen cause these problems is BoundColumn columns. In edit
mode, these generate <input type="text"> fields, but without any size
attribute. That causes the column width to change. I replaced them with a
template column (with a size attribute) and the problem was gone.

John Saunders
Nov 19 '05 #2
Thanks John.. I will try that.
Regards,
Bazza

"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:ez**************@tk2msftngp13.phx.gbl...
"Bazza Formez" <ba**********@paradise.net.nz> wrote in message
news:lM********************@news02.tsnz.net...
Hi there,
What determines the sizes of rows / columns / cells when a grid is in
edit mode ?

When I click the edit command of a row item, the whole grid 'bounces' to
a much larger size... and after update it reduces back again.

I have a custom crafted grid (AutoGenerateColumns = False) ... and can
have not placed any setting that would seem to cause this behaviour.

Is this a default type bahaviour ? How should I work around this such
that disconcerting size changes do not occur ?


Remember that it's all just HTML.

To find the answer, create a simple reproducer. Then, look at the HTML via
View Source befoire you put it into edit mode, and then look again
afterwards.

One thing I've seen cause these problems is BoundColumn columns. In edit
mode, these generate <input type="text"> fields, but without any size
attribute. That causes the column width to change. I replaced them with a
template column (with a size attribute) and the problem was gone.

John Saunders

Nov 19 '05 #3
On Thu, 09 Dec 2004 13:12:40 +1300, Bazza Formez wrote:
Hi there,
What determines the sizes of rows / columns / cells when a grid is in edit
mode ?

When I click the edit command of a row item, the whole grid 'bounces' to a
much larger size... and after update it reduces back again.

I have a custom crafted grid (AutoGenerateColumns = False) ... and can
have not placed any setting that would seem to cause this behaviour.

Is this a default type bahaviour ? How should I work around this such that
disconcerting size changes do not occur ?


When a datagrid is in item view the widths of the columns are
automatically set to the widest necessary for the data, when in edit mode
the width of the textboxes decides the width of the columns. You could fix
the width of the columns with the itemstyle property so that the columns
are as wide as the edit textboxes when in item view.

Tony

Nov 19 '05 #4
I think this is the default behavior. I solved this problem writing the
following code in the EditCommand event, which you can adapt to your
purposes:

private void grdPolicy_EditCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e) {

this.lblMessage.Text = "";

this.saveSelection();

this.grdPolicy.EditItemIndex = (int) e.Item.ItemIndex;
this.gridBind();
this.grdPolicy.Columns[(int) NumColumns.select].Visible = false;

// cambiare le dimensioni del text grid per l'editazione

System.Web.UI.WebControls.TextBox txt;
txt = (TextBox) this.grdPolicy.Items[(int) e.Item.ItemIndex].Cells[(int)
NumColumns.issuing].Controls[0];
txt.Columns = 10;
txt = (TextBox) this.grdPolicy.Items[(int) e.Item.ItemIndex].Cells[(int)
NumColumns.expiry].Controls[0];
txt.Columns = 10;
txt = (TextBox) this.grdPolicy.Items[(int) e.Item.ItemIndex].Cells[(int)
NumColumns.premium].Controls[0];
txt.Columns = 10;
if (decimal.Parse(txt.Text) == 0) {
txt.Text = "";
}
}
As you can realize, you can change the Columns property of the text boxes
for the columns which aren't read only. I hope this can help you.
--
Vanni Tomezzoli
S. Donato Mil., Milano, Italy
http://xoomer.virgilio.it/vtomezzo

"Bazza Formez" <ba**********@paradise.net.nz> ha scritto nel messaggio
news:lM********************@news02.tsnz.net...
Hi there,
What determines the sizes of rows / columns / cells when a grid is in edit
mode ?

When I click the edit command of a row item, the whole grid 'bounces' to a
much larger size... and after update it reduces back again.

I have a custom crafted grid (AutoGenerateColumns = False) ... and can have not placed any setting that would seem to cause this behaviour.

Is this a default type bahaviour ? How should I work around this such that
disconcerting size changes do not occur ?

thanks,

Bazza

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gord | last post by:
Hello, Anybody know how to detect when a user drags between columns in a MSHFlexGrid when resizing column width? (Short of setting up a timer event that continuously monitors column width.)...
2
by: Will | last post by:
Hi I've been looking a way to put buttons in a column, but almost every example is for WebForms and I need it for WinForms... I found a way for doing it, with the DataGridColumnStyle class,...
3
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
2
by: Raj | last post by:
Hi, When we are sorting the DataGrid Boolean column the grid is becoming redcross. I have my own PPMIPDataGridBoolColumn class inherited from System.Windows.Forms.DataGridBoolColumn. In this...
4
by: Mike | last post by:
Hi, Is there a possibility to have one of the Web Control Datagrid's column as a Calendar when editing data? Any resources on this subject? Thanks Mike
2
by: Peter Proost | last post by:
Hi group I'm making my own datagrid control, so for I've got a lot of things working, combobox columns, checkbox columns, blobfield columns. But now I would like to be able the disable certain...
4
by: Aaron Smith | last post by:
Ok, this is an odd one, but I could use some assistance with the framework 2 in VB.Net... I want to have a DataGridViewColumn, only have it use the ComboBox, then when they drop down the...
5
by: bob | last post by:
Now this ought to be a simple matter. But nothing's simple in the Net world, I'm finding. In vb6 you could use "!" to force text to upper case in the format function. I've searched the vb.net...
2
by: schaapiee | last post by:
Is there a way to define how long the data columns are, display wise on the Form? Whether I am using a boolean field (checkbox) or a string field (text url) each displays with the same size. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.