setting the edit control's size relative to non-edit cell size

I have a DataGrid with dynamically added custom edit controls.  Some of the strings that go into the custom control (the control might be a TreeView, or a ListBox)  are long, and this does funky things to the cell size in edit mode.

**I basically want the added control (e.g., a listbox) to be the width of the host cell, and 4X the height....all the time**
(in the grid's ItemDataBound callback for edit)

//create a new listbox, clear the edit cell's controls, and add the listbox
listbox.Height = new Unit("100%") ; //this makes the listbox’s height just the host cell height, not good
listbox.Width = new Unit("100%"); //this makes the host cell super wide and squishes my other columns, not good
<or>
listbox.Height = new Unit("200px") ; //this is better, but I’d prefer to base this on the host cell’s height X 4
listbox.Width = new Unit("200px"); //this is better, but I’d prefer this be the host cell’s width, minus a few pixels

I also tried this:


Unit uh = e.Item.Cells[2].Width; //the width shows 0, so this doesn’t help
Unit uw= e.Item.Cells[2].Height; //the height shows 0, so this doesn’t help

Does anyone know how i do this properly? Thanks!
0
Steve1999
1/19/2004 3:30:26 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
612 Views

Similar Articles

[PageSpeed] 41

I don't think this is possible. A column's width is determined when the HTML is rendered on the client. The server has no clue was this size will be...unless you specify the column's width beforehand in the property builder. Otherwise, the sizing is dynamic on the client.

You could possibly write client-side javascript that would resize the controls by querying the DHTML properties such as clientHeight and clientWidth of the TD they reside in, but this would be a nightmare to write...and I don't think it would be practical.
0
jbutera
1/20/2004 7:03:38 AM
Reply:

Similar Artilces:

IWDBEdit control set to IWDBGridColumn.Control not editable [Edit]
Hi folks. I'm relatively new to IntraWeb and am having trouble with my application. It is a simple app that is supposed to show a list of user accounts in a grid and allow the user to edit data in the accounts. I have a TADOQuery connecting to MS SQL, with 'Select * from UserAccounts' as the sql text. I have a TDataSource with the Dataset property pointing to my TADOQuery object. Both of these objects exist as part of the UserSession. On my main form, I have an IWDBGrid, IWDBNavigator, and an IWDBEdit control. They are all hooked up to the TDatasource in the UserSessi...

Setting a panel control's visibility and it's affect in nested controls.
I am trying to debug a page using the panel control.  The code in the final submission of the form has logic to get data from a dropdown based on the control's visibility.  If the control's visibility is set to true, the the data is retrieved and sent to the database.The problem appears to be the dropdown control's visibility is set to false when it should not.  The dropdown is nested in a panel control.  While doing a trace, it appears when a panel control's visibility is set to false, the visibility for all controls nested under this panel are set to false as well.You'r...

how to set the size of the datagrid(or the control inside) in editing mode
my problem is when i click the edit button in the datagrid, it extends to the right which is beyond the screen. how can i set the size of the datagrid(or the control inside) to maintain the current cell size. Hi, To set the size of a control inside datagrid ... you must use template column, instead of bound column. In the template column, you can specify the width of the contained control. HTH -ShamirShamir A AhmedNational Bank Of KuwaitTogether we are, together we grow...

Rich Text Edit Control Page size setting...
Hello All, I believe this question has been asked over & over again but i did not find a good solution , my problem is how to set the Page to Legal Size in Rich Text Edit with out manipulating the printer setting of the computer?. Is there any one who has done this with out setting the printer properties of the system. If anyone can share API calls that would do this would be great. I am using PB 10.5.1 Build 6565. I have a business requirement that allows the users to view and print documents built in RichText in Legal size. Thanks in Advance Suresh ...

Label control's text doesn't appear to be set (in the page which has a user control )when trying to update the text property in the FormView's ItemUpdated event
Hi There,I have a user control which hosts a formview control, gridview control and a label control. The grid view is usedto show rows in the DB and when clicked to edit each row, a form view opens up in edit mode with that particular row info. So I have nothing in the item template.My first question is..is it mandatory to have smth in the itemtemplate of the form view.I have controls in edititemtemplate and insertitemtemplate.When a particular row is edited, I would like to show a status msg showing that the row has been updated.For this, I use the ItemUpdated event of the formview and try ...

Can I change a treeview's text size depending on what my browser's text size is set to?
I'm using a treeview on a .net 2.0 page and all is working fine with it in Internet Explorer.  However if I go to View -->  Text Size --> Largest on my browser's menu, all the text on my page appears huge apart from the text in the treeview which remains the same size as it always was.  Is there a way to fix this so that this text will also increase in size? Many Thanks. Make sure the font size is not set in the control.  And use css to help moderate your pages look and feel. HTH,Joe JohnstonIf a picture is worth a 1000 words, a sample application ...

Difference between ASE 12.5.1 Developer's Edition and non-Developer's Edition
I am looking for differences between the free developers edition of ASE12.5.1 and the regular ASE 12.5.1. I noticed the OCS-12_5 in the Developer's Edition does not have the include directory and the lib directory only has the .so files and not the .a files. Any help? On Thu, 20 May 2004 21:02:05 -0700, wrote: > I am looking for differences between the free developers edition of > ASE12.5.1 and the regular ASE 12.5.1. I noticed the OCS-12_5 in the > Developer's Edition does not have the include directory and the lib > directory only has the .so files and not...

formview
Hi, I have a formview with a number of controls. I have been trying to set some controls after the page loads with no luck. Here is an example of what I'm doing: if (FormView1.CurrentMode == FormViewMode.Insert){  TextBox idTextBox = (TextBox)FormView1.FindControl("TextBox1");  idTextBox.Text = Session["id"].ToString();} I've added the code to the Page_Load and Form_Load but it doesn't work. I've even tried to just focus the textbox using idTextBox.Focus() but that won't work. I made a test page not using formview and and things work fine. The FormView is o...

Admin can't see 'Edit Text' control at the bottom of editable modules
I have an admin who can't see the module level Edit command when logged into her machine.  If she changes to another machine, and logs in with the same account, it is fine, but from her machine she can't see the "edit" text or the pencil or the settings icon for any module.  She can see the Admin controls at the top, but the modules themselves seem to have no edit controls.There are no appreciable differences between the machines, that I know of.  They are build from the same Ghost image.  Obviously something is different but I have no clue what it would be.  Any tho...

Unable to access user control's user control's function\property from another user control
Hi, I used to call an user control's user control function as stated below from my user control in ASP.Net 1.1 wucCompany.wucEmployee.GetEmployeeSomething() After migrating to ASP.Net 2.0, I am unable to use any properties/functions(even the public ones) of the user control's User control's from another user control.  The way I have to do is create property\function in wucCompany which calls the wucEmployee's property\function and call the wucDepartment.GetEmployeeSomething().Since I need to do this change in too many places, I can...

superreview cancelled: [Bug 146075] 'Message > Edit Message As New' (== 'Edit As New...') set an incorrect initial "X-Priority:" value (when present), which messes up 'Options > Priority' U.I. also :
Serge GAUTHERIE <gautheri@noos.fr> has cancelled Jean-Francois Ducarroz <ducarroz@aol.net>'s request for superreview: Bug 146075: 'Message > Edit Message As New' (== 'Edit As New...') set an incorrect initial "X-Priority:" value (when present), which messes up 'Options > Priority' U.I. also http://bugzilla.mozilla.org/show_bug.cgi?id=146075 Attachment 136206: (Av2) 'mime_generate_headers()' http://bugzilla.mozilla.org/attachment.cgi?id=136206&action=edit ...

superreview requested: [Bug 146075] 'Message > Edit Message As New' (== 'Edit As New...') set an incorrect initial "X-Priority:" value (when present), which messes up 'Options > Priority' U.I. also; a #3
Serge GAUTHERIE <gautheri@noos.fr> has asked David Bienvenu <bienvenu@nventure.com> for superreview: Bug 146075: 'Message > Edit Message As New' (== 'Edit As New...') set an incorrect initial "X-Priority:" value (when present), which messes up 'Options > Priority' U.I. also; and code cleanup. http://bugzilla.mozilla.org/show_bug.cgi?id=146075 Attachment 150091: (Ev1) 'Options > Priority > ...' menu http://bugzilla.mozilla.org/attachment.cgi?id=150091&action=edit ------- Additional Comments from Serge GAUTHERIE &l...

superreview requested: [Bug 146075] 'Message > Edit Message As New' (== 'Edit As New...') set an incorrect initial "X-Priority:" value (when present), which messes up 'Options > Priority' U.I. also : #8
Serge GAUTHERIE <gautheri@noos.fr> has asked Seth Spitzer <sspitzer@mozilla.org> for superreview: Bug 146075: 'Message > Edit Message As New' (== 'Edit As New...') set an incorrect initial "X-Priority:" value (when present), which messes up 'Options > Priority' U.I. also http://bugzilla.mozilla.org/show_bug.cgi?id=146075 Attachment 136181: (Cv1) <MsgComposeCommands.js> http://bugzilla.mozilla.org/attachment.cgi?id=136181&action=edit ...

superreview requested: [Bug 146075] 'Message > Edit Message As New' (== 'Edit As New...') set an incorrect initial "X-Priority:" value (when present), which messes up 'Options > Priority' U.I. also : #7
Serge GAUTHERIE <gautheri@noos.fr> has asked Seth Spitzer <sspitzer@mozilla.org> for superreview: Bug 146075: 'Message > Edit Message As New' (== 'Edit As New...') set an incorrect initial "X-Priority:" value (when present), which messes up 'Options > Priority' U.I. also http://bugzilla.mozilla.org/show_bug.cgi?id=146075 Attachment 136207: (Dv1) <MailNewsTypes.h> http://bugzilla.mozilla.org/attachment.cgi?id=136207&action=edit ...

Web resources about - setting the edit control's size relative to non-edit cell size - asp.net.presentation-controls

Resources last updated: 12/5/2015 12:24:14 AM