Hi Nedu,
I agree with the answer from Alvin. I'd like to add more information.
Before clicking edit, you may control the column width in the
DataGrid.ItemCreated. The following is a code snippet for demonstration.
private void DataGrid1_ItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item ||e.Item.ItemType==
ListItemType.AlternatingItem)
{
e.Item.Cells[0].Attributes .Add("width","100");
}
}
After clicking edit, you may control the column width of controls in the
DataGrid using DataGrid.PreRender event. Please check a code snippet below
for a demonstration. You may modify the code to meet your requirements.
private void DataGrid1_PreRender(object sender, System.EventArgs e)
{
int n=DataGrid1.EditItemIndex;
if (n!=-1)
{
TextBox t1=(TextBox)DataGrid1.Items [n].Cells [1].Controls[0];
t1.Width =150;
}
}
Does this answer your question? Please let me know if you need more
information
Best regards,
Lewis
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Reply-To: "Nedu N" <
[email protected]>
| From: "Nedu N" <
[email protected]>
| Subject: controlling size of editcommand column in edit mode
| Date: Fri, 15 Aug 2003 09:46:47 -0700
| Lines: 8
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| NNTP-Posting-Host: machine45.qwest.net 204.154.239.45
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:6177
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| I am facing problem in controlling the size of the edit command coulmn
| after...both before clicking edit and also during when we see the
| update/cancel look...i have got imgaes instead of Edit and Update/Cancel
| text...
| Also i face problems in controlling the column widths in edit mode on my
| template columns....Item-Style width doesn't seem to work....
|
|
|