Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > DataGrid Edit TextBox

Reply
Thread Tools

DataGrid Edit TextBox

 
 
Aidal
Guest
Posts: n/a
 
      11-03-2005
Hi NG.

I'm having trouble controling the size of the textboxes that appear when the
user clicks the "edit" button for a row in my datagrid.
I know it can be done and I know it doesn't require much, but I just can't
seem to find out how to anyway.

If anyone could help me out with this little problem it would be much
appreciated

Thanks
/Aidal


 
Reply With Quote
 
 
 
 
alvinz_c
Guest
Posts: n/a
 
      11-09-2005
Hi, Aidal, you have two ways to do it. If you are using the BoundColumn, then
you can set the width of textbox in the ItemCreated event.

protected void dgrd_ItemCreated(Object sender, DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.EditItem)
{
TextBox txt = (TextBox)e.Item.Cells[X].Controls[0];
txt.Width = < the width you want it to be>;
}
}

Another way is set the TextBox's width declaractively in the TemplateColumn.


Hope this helps....
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Snapshot restraint - edit, edit, edit Alan Browne Digital Photography 24 05-10-2005 10:15 PM
Snapshot restraint - edit, edit, edit Patrick Digital Photography 0 05-06-2005 10:53 PM
Edit All Function for DataGrid, and Moving the Edit Function in a DataGrid Schultz ASP .Net 3 02-14-2005 04:47 AM
Set the width of the edit textbox after clicking on Edit link in datagrid... Sharon McCarty ASP .Net Datagrid Control 0 11-24-2004 06:41 PM
To all Gurus: How can I edit/update a DataGrid in a DataGrid (nested DataGrid)? Possible? Andreas Klemt ASP .Net Datagrid Control 0 10-08-2003 01:19 AM



Advertisments