fixed gridview size with images asp.net - asp.net

I have a GridView with an ImageField and a ButtonField in it.
The Image is large .. but i want it to be displayed in a smaller size in the grid.. so I'm looking for a way to fix the cell size of my GridView.
How can I do this?

I had the same problem; solved it this way:
<asp:ButtonField ButtonType="Image" CommandName="EliminarFuente" HeaderText="Eliminar" ImageUrl="~/Themes/Images/Delete.png" >
<ControlStyle CssClass="BotonDeImagen"/>
<ItemStyle HorizontalAlign="Center" />
</asp:ButtonField>
The CSS class is like this:
.BotonDeImagen
{
width:25px;
height:25px;
}
and the result is a centered image of 25*25 pixels.
Alternative solution:
You could define height and width on the ControlStyle tag, instead of using a CSS class.

You can make set HighQualityBicubic InterpolationMode when you do the BinaryWrite
Checkout this example code.

Try using these two properties on your ImageField.
ItemStyle-Width=""
ItemStyle-Height=""

Explicity set the height and width of the image. Use CSS to control the size of the rendered tags.

Related

Cant change width of telerik:RadComboBox

Using Telerik RadComboBox for asp.net. Having trouble setting the width of the control. No matter what I change the width do it doesn't have any effect....
<telerik:RadComboBox RenderMode="Classic" Skin="Default"
EnableBrowserButtonStyle="true"
ID="ddlSelectedItems" runat="server" CheckBoxes="true"
EnableCheckAllItemsCheckBox="true"
Width="245px" Label="" />
Any suggestions?
Unfortunately, the RadComboBox always sets its width to 100%, no matter what you set the Width property to. The only way I could find to work around this is to wrap the control in a tag with a display attribute of either block or inline-block, and put the width style on the wrapper (or use a class to apply the width).
<div style="width: 245px;">
<telerik:RadComboBox RenderMode="Classic" Skin="Default"
EnableBrowserButtonStyle="true"
ID="ddlSelectedItems" runat="server" CheckBoxes="true"
EnableCheckAllItemsCheckBox="true"
Label="" />
</div>
Can you set the RenderMode property to Lightweight and test again:
This works on my side.

Datalist items display when based on number of items

I am using DataList control in ASP.net application. I have set
DataList1.RepeatColumns = 3;
DataList1.RepeatDirection = RepeatDirection.Horizontal;
properties of DataList. When item count is more than 3 it shows up properly. However if it is less than 3 it distorts and occupies whole space.
e.g. if there is only 1 item, it takes complete width and distorts UI.
if $$$ is one item, for 3 it shows like,
$$$|$$$|$$$
for one item it shows like
$$$$$$$$$$$
and UI disturbs completely.
Is there any way to format display in proper manner?
As lcarus mentionned, try setting ItemStyle-Width property. Here is a snippet which worked for me:
<asp:DataList ID="myDataList" runat="server" RepeatColumns="3" HorizontalAlign="Center" RepeatLayout="Table" RepeatDirection="Horizontal">
<ItemStyle Width="33%" />
<ItemTemplate>
<your code here>
</ItemTemplate>
</asp:DataList>
When requiring 3 columns, set the column width to 33%.
Try setting the ItemStyle-Width property to the desired width. I would expect it to set the width of each item to the exact size you set it to: Here's a link to MSDN documentation: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datalist.itemstyle.aspx

Div produced from an ASP.Net GridView is too large

I have an ASP.Net GridView with properties like so:
<asp:GridView ID="grdOrderEntry" runat="server" AutoGenerateColumns="false" ShowFooter="True"
DataKeyNames="oid" Height="100%">
When I view the control in the browser, there is a lot of white space after the control. When viewing the HTML, the div that is produced by the GridView is much larger than the control, causing the whitespace. Is there a property I can set on the GridView to make the div as small as possible?
If you set the CssClass property you will be able to create some css to address the problem. I would recommend using a live css editor so you can mess around with it until you get the desired effect.
I suspect this is being caused by your Height="100%" attribute, remove that, and it should just stretch around the table it contains (unless there is some css other style added to it as well).

Telerik Grid Row color

Is the only way to change the background color of a row based on data on the Telerik grid by doing it in the ItemDataBound event? I have a grid that a huge amount of data and it is taking a really long time. I have a property in the data row that tells me what color the row needs to be. I would like to be able to dynamically set the css class at runtime.
Thanks,
Rhonda
You should be able to change the row color using ItemStyle and AlternatingItemStyle:
<MasterTableView AutoGenerateColumns="false" ShowFooter="true">
<ItemStyle BackColor="PeachPuff" />
If you are looking to specifically change the style of the row during the OnItemDataBound event I recommend that you look at this documentation article from the Telerik online documentation. It covers how you can set inline styles from the code-behind, or use predefined CSS styles and apply them to the rows.

how to make grid footer lines to none in gridview

i want to disable Footer gridlines in gridview.How can we do this
use <FooterStyle CssClass="FooterStyle" /> on your grid view and add .FooterStyle{border:0;} in your css

Resources