Cant change width of telerik:RadComboBox - css

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.

Related

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

validator text contaiing divs - prevent from being displayed when validator is ok

I have a validator that has the associated error text set as below.
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ValidationGroup="1" ControlToValidate="EmailTB"
Text="<div class='error-left'></div><div class='error-inner'>required</div>"
Display="Static" Width="100%" runat="server" SetFocusOnError="true" />
I put this validator on the third td of a tr. Th first two td are the name of the field and a textbox. The problem is that even if the error text is not shown, it seams to dstort the whole table layout by having width and height. I understand that ASP>NET uses javascript to make the text inside visible when the error text should be shown, but I don't like the fact that the layout is distorted by the height of a label which should not be activated. Look in the photo bellow:
Observations:
- This is the only validator in the form, this is why the tr for the email is so high (as the error-left class has this height)
Change the Display property to Dynamic - which will have the style set to "display: none;" until it's triggered.
Instead of including code even when there is no error, make it include code only if there is an error.

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).

fixed gridview size with images 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.

set the height of freetextbox

How should I go about setting the height of freetextbox? I want to size the textbox reasonably based on the lenght of the text in the textbox.
simply set the height property of textbox as much you want... like..
<FTB:FreeTextBox ID="txtDesc" runat="server" Width="590px" Height="300px" ></FTB:FreeTextBox>

Resources