i have a Gridview with a single column which is a template field with an image and a label.
By default, the gridview expands vertically according to the items in the datasource.
But in my case most of the screen space is left unused and the page becomes extremely long.
So it'd be great if the one and only template field automatically becomes a new column (starts again from the top next to it's initial position after a fixed height) or SPANS HORIZONTALLY, not vertically...
i've done some searching and still can't find a solution for this..
any help would be great..!
i took 2 screenshots for a better explanation but the site won't allow me to post images yet :/
I think you are looking for the DataList control. Namely, the RepeatColumns property.
Related
i have two gridview in two different tr and td,i want to display one of them by setting visibility true or false but when i run it though only one is visible but the position of gridview remains static as it should be placed on the top which is not happening.Help me out
Is there any reason you use a table to show these grids? If I have understood you correctly, you need the bottom grid to take the space above, if the top grid is not visible. I strongly recommend not to use a table for this, but relative positioned divs. If you MUST use a table, use javascript to resize your top row, when needed.
I'm using a List control.
In the renderer of the List control I've got a Repeater.
Each Repeater can have a different number of items.
Adding to the complexity, one of the components being repeated in the
repeater is a Text control that has long text that will wrap,
increasing it's height.
I need to expand the height of the List completely so that there's no
vertical scrollbar.
How can I do this?
I tried an extremely dirty attempt at calculating the Lists height
based on the data source. From the data source I can figure out the
number of repeater items and the number of items in each repeater in
the List's renderer. But there's no way to compensate for the wrapping
of the text in the Text control.
Is there a better way (or any way!) to do this? Please help.
Thanks in advance,
zxcvb
This method might help measureHeightOfItems()
I am using Telerik's Radgrid for a website. Often the grid columns exceed the available width, and extend outside the main content area (fixed width).
So what are my options for presenting very wide grids. horizontal scroll bars just look ugly on my site
Your choices are a combination of the following:
Smaller fonts
Consolidate some cells to have more than one row (e.g. if you have a "start date" and "end date" put the start date on top and the end date on the bottom.
Widen the window
Make some cells appear conditionally (based on user-defined filters). Maybe the most frequently used cells appear normally and a checkbox unhides the less frequently used cells or groups of cells.
Allow horizontal scrolling
Make the window a fluid width
Popup data in a floating <div> via javascript instead of putting it in a column
Am I missing anything?
i am using telerik controls too, one thing i have learned after a lot of work with them is their CSS is usually good, but i also face your problem, and here is my advise.
what Keltex said.
always add a custom class to your Rad Grid where you do fix those nasty stuff.
don't use fixed width for Grid, instead use it on columns and make the grid Fluid, so does the page.
hope this helps.
I agree with devmania and making the grid fluid, I had a similar problem recently. So I made a few of my columns nowrap and left the rest to wrap. It doesn't look great on smaller screens but it's still usable because I've stopped things like date+time columns wrapping. However, once you start using it on a wider screen it looks great.
It all depends on how much of a scrollbar you have. Is it possible to strip out some of the columns and have that information in a popup/flyout somewhere?
Another option is to make which columns are shown user configurable, but you're not really addressing the problem, just making it the responsibility of the user to make it look nice.
If you can't get rid of the horizontal scrollbar you should at least try to put the more important columns first so that your users don't have to scroll to the right very often.
I have a number of GridView controls that I need to position side-by-side on a page. For example a GridView containing a list of items in a shopping basket, and a number of GridViews to the side showing pricing from a number of suppliers.
The columns are fixed width in the first GridView - meaning that the row height is variable depending on the amount of text.
So, the question is this - is there any way to discover the individual row heights of the first data-bound GridView such that I can alter the other GridViews to correctly align?
The Row.Height property of the grid after databinding is empty as the height has not been explicity set.
thanks!
I don't know of any way to do this in .Net, you can use javascript, maybe set a .Net hidden field on load if you need it in code behind :
var h = document.getElementsByTagName('td')[0].offsetHeight;
Keep in mind this height will also include any cell padding or spacing you have set. Also, this assumes you're not explicitly setting the height in CSS which based on your question I assume you are not.
I am designing a page to Add/Edit users - I used a repeater control and a table to display users. In users view the individual columns of the table row have labels to display a record values and when users click on edit button, the labels are hidden and text boxes are displayed for users to edit values - The problem is - as soon as the text boxes are visible, the table size increases - the row height and cells size becomes large. Is there a way to display the text boxes so that they take the same size as the labels
Dealing with tables, the question is: can your labels span on multiple text rows (ie: can you have long texts)? If yes, you may encounter layout problems any way. If no, a simple approach can be creating a CSS Class:
.CellContent { display:block; width: ...; height: ...; }
with your preferred cell width/height. Just stay a bit "large" with your height.
Assign the class to both your label and textbox, and you should not get width/height changes when switching control (thanks to the display:block property).
Again, if you have long texts, you will still encounter issues, and may want to use multilines. In that case, I would suggest ignoring height problems: just set the width to be consistent, and always show a 3-4 lines textbox for editing. Users will not be bothered to see a row height change, if they are ready to type long texts.
I'd use JS+CSS... You'll have to get your hands dirty for this one though. Visual Studio isn't going to help you much.
Here's how I'd do it:
Get the <td> clientWidth and clientHeight.
Set the <td>'s width and height to those px values (so they're no longer relative)
Swap the text for the input
In your CSS, make sure the input has no padding/margin/border and set width:100%, line-height:1em, and height:1em
When you switch back, make sure you un-set the <td> width and height so they return to automatic values.
You'll need to tweak this all slightly. I'm sure you'll have to play around with the padding on the <td> and perhaps set overflow:hidden but you should be able to do what you want.