Hi Ronald,
I think that it depends of how you declare your grid, below you will find an
example of how I do it, you will see that I declare my controls in the way I
want.
<asp:templatecolumn ItemStyle-VerticalAlign="Top" ItemStyle-Width="550"
ItemStyle-HorizontalAlign="left" ItemStyle-CssClass="comunrow">
<itemtemplate>
<asp:Label Runat="server" Text='<%#
((CtpSentVia)Container.DataItem).Name%>' ID="Label23">
</asp:Label>
</itemtemplate>
<EditItemTemplate>
<asp:TextBox Width=100 CssClass="text" Runat="server" ID="SentViaName"
Text='<%# ((CtpSentVia)Container.DataItem).Name%>'></asp:TextBox>
<asp:CustomValidator id="Customvalidator2"
ControlToValidate="SentViaName"
OnServerValidate="ServerValidation"
ClientValidationFunction="IMValidator"
Display="Static"
ValidateIfBlank="yes"
ErrorMessage="*"
PopUPMessage="The Name can not be null"
runat="server"/>
</EditItemTemplate>
</asp:templatecolumn>
If you don;t use the TemplateColumn construction then you could set the
different parameters of the TextBox, the pseudocode below will give you an
idea:
protected void EditHandler( sender o, ... )
{
//get the selected row
int rowselected = grid.SelectedIndex;
TextBox textbox = (TextBox) grid[ rowselected].FindControl("TextBox
Name");
textbox.Width = 40;
}
Hope this help,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Ronald S. Cook said:
Hi all,
I have an ASP.NET DataGrid wherein there is an edit link for each row. Upon
clicking the link, certan fields in that row display in text boxes so that
they may be edited. I would like some textboxes to be wider, some narrower.
By default, they are all the same pre-defined width.
Does anyone know how I can do this?
Thanks very much,
Ron