This is a migrated thread and some comments may be shown as answers.

[Solved] Width change on postback

7 Answers 333 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Preetam Ray
Top achievements
Rank 1
Preetam Ray asked on 30 Apr 2008, 04:14 AM
Hi,

I have a radcombobox that changes its width on ajax postbacks. I've tried the workarounds given in  the KB but none of them work.

For the "FixUp" workaround, I get a runtime error saying that "Object does not support this property or method" for FixUp.

Setting the width in CSS doesn't help either.

The comboboxes are placed within a rad tabstrip. Three tabs - each having a combo that requires a postback (Country dropdown that populates State dropdown). On selecting a value in the Country dropdown, all the combos change their widths on postback.

HELP!

Thanks,
Nikhil

7 Answers, 1 is accepted

Sort by
0
Helen
Telerik team
answered on 30 Apr 2008, 10:37 AM
Hi,

What is the exact version of RadComboBox, the ASP.NET AJAX or the regular ASP.NET versions that you are using? Also it will be helpful if you can send us your code to examine it locally. Without this information, we cannot say what is causing the problem.


Regards,
Helen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kevin
Top achievements
Rank 1
answered on 23 Jun 2008, 10:08 PM
We are having this problem as well. 

We are setting the Width attribute on the drop down box declaratively to 190 pixels, but on postback, it "shrinks" somewhere around 25 - 30 pixels. This is very weird!

We are using Q1 2008 controls.

Please help! Thanks!
0
Kevin
Top achievements
Rank 1
answered on 23 Jun 2008, 10:08 PM
It's also the regular ASP.NET version.
0
Kevin
Top achievements
Rank 1
answered on 23 Jun 2008, 10:10 PM
Here is some code:

<html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
   <link href="css/ECASTCore.css" rel="stylesheet" type="text/css" />
        
        <!--[if IE]>
                <link href="css/ie6.css" rel="stylesheet" type="text/css" />
        <![endif]-->
    </head>
    <body>
   <form id="form1" runat="server">
    
   <table id="uploaderSearchTable" class="fieldPanel" cellpadding="0" cellspacing="0">
   <tr>
   <td>
   <div class="fieldPanelHeading">
   <div class="fieldPanelHeadingTitle">
   Search Tailored Resumes
   </div>
   
   <div class="fieldPanelHeadingButtons" style="width: 66px;">
           <asp:Button ID="bSearch" runat="server" CssClass="VistaButton" Text="Search" OnClick="bSearch_Click" />
       </div>
   </div>
   
   <div style="float: left; clear: both;">
        <div class="label" style="float: left; width: 217px; padding-left: 1px;">Tailored For</div>
   <div class="label" style="float: left; width: 217px; padding-left: 1px; margin-left: 4px;">Details</div>
   <div class="label" style="float: left; width: 214px; padding-left: 1px; margin-left: 7px;"">Proposal Name</div>
       </div>
       
       <div style="float: left; clear: both; width: 662px; margin-top: 5px;">
   <div style="float: left; width: 218px;">
       <rad:RadComboBox runat="server" ID="cbTailoredFor" Skin="Vista" Width="190" DropDownWidth="195" Height="80" />
   </div>
           <div style="float: left; width: 218px; margin-left: 4px;">
       <rad:RadTextBox runat="server" ID="tbDetails" Skin="Vista" Width="212" />
   </div>
           <div style="float: left; width: 215px; margin-left: 7px;">
       <rad:RadTextBox runat="server" ID="tbProposalName" Skin="Vista" Width="212" />
   </div>
</div>
   
   <div style="margin-top: 20px; float: left; clear: both;">
   <rad:RadGrid runat="server" ID="searchResultsGrid" Skin="Mac" Width="662" GridLines="None"
   AllowPaging="true" AllowSorting="true" EnableAJAX="true" PagerStyle-AlwaysVisible="true"
   OnNeedDataSource="searchResultsGrid_NeedDataSource">
    
   <MasterTableView Width="662" PageSize="10" AutoGenerateColumns="False" DataKeyNames="ResumeID">
   <Columns>
   <rad:GridBoundColumn DataField="Employee" HeaderText="Employee" AllowSorting="false" />
    
   <rad:GridTemplateColumn HeaderText="Tailored For">
   <ItemTemplate>
   <asp:Label ID="Label1" runat="server" Text='<%# ( ( TailoredFor )DataBinder.Eval( Container.DataItem, "TailoredFor" ) ).ToFormattedString() %>'></asp:Label>
   </ItemTemplate>
   </rad:GridTemplateColumn>
    
   <rad:GridBoundColumn DataField="Details" HeaderText="Details" />
    
   <rad:GridBoundColumn DataField="ProposalName" HeaderText="Proposal Name" />
    
   <rad:GridHyperLinkColumn HeaderText="File Name" Target="_blank" DataTextField="FullFileName"
   DataNavigateUrlField="RemoteUri">
   </rad:GridHyperLinkColumn>
    
   <rad:GridBoundColumn DataField="StatusValue" ItemStyle-Width="10%" HeaderText="Status">
   </rad:GridBoundColumn>
    
   <rad:GridTemplateColumn HeaderText="Status">
   <ItemTemplate>
   <%# ( // black magic happens here
                                    ( ( DateTime? )DataBinder.Eval(Container.DataItem, "ApprovedDate" ) == null )
                                        ? ( ( DateTime? )DataBinder.Eval(Container.DataItem, "UploadedDate" ) )
                                        : ( ( DateTime? )DataBinder.Eval(Container.DataItem, "ApprovedDate" ) )
   ).ToDescriptiveFormat((ProfileStatus)DataBinder.Eval( Container.DataItem, "Status" ) ) %>
   </ItemTemplate>
   </rad:GridTemplateColumn>
    
   <rad:GridTemplateColumn>
   <ItemTemplate>
   <asp:HyperLink runat="server" Text="View Profile" Target="_parent" NavigateUrl='<%# "~/HttpHandlers/ProfileHandler.ashx?employeePk=" + (Container.DataItem as Resume).EmployeePk %>'></asp:HyperLink>
   </ItemTemplate>
   </rad:GridTemplateColumn>
   </Columns>
   </MasterTableView>
   </rad:RadGrid>
   </div>
   </td>
   </tr>
   </table>

   </form>
    
    </body>
</html>




And here is the Styles.css that doesn't fix anything:

/* RadComboBox Vista embedded skin */

.ComboBoxDropDown_Vista
{
border: 1px solid #c6c7d2;
border-top: 1px solid #83868d;
background: #fff;
text-align:left;
filter: progid:DXImageTransform.Microsoft.Shadow(strength=3,color=#646464,direction=135);
float: left;
}

.ComboBoxHeader_Vista
{
background:url(headerBg.gif) repeat-x #f1f2f4;
border-bottom: 1px solid #d5d5d5;
padding:3px 0; /* no side padding ! */
font: normal 11px/16px "segoe ui", arial, sans-serif; 
float: left;
}

.ComboBoxImage_Vista
{
vertical-align:middle;
margin-left:-3px;
float: left;
cursor: pointer;
}

.ComboBoxImageHover_Vista
{
vertical-align:middle;
margin-left:-3px;
float: left;
cursor: pointer;
}

.ComboBoxInput_Vista,
.ComboBoxInputHover_Vista
{
height: 23px; /*only IE applies this*/
vertical-align: middle;
padding-top: 4px;
padding-bottom: 2px;
padding-left: 3px;
cursor: pointer;
font: normal 11px "segoe ui",arial,verdana,sans-serif;
background: url(bg.gif) repeat-x #cfcfcf;
border: solid 1px #707070;
float: left;
}

.ComboBoxInput_Vista
{
color: #222222;
}

.ComboBoxInputHover_Vista
{
color: #06c;
}

.ComboBoxItem_Vista,
.ComboBoxItemHover_Vista,
.ComboBoxItemDisabled_Vista
{
font:normal 11px "segoe ui",arial,verdana,sans-serif;
text-decoration: none;
text-align: left;
height: 14px;
cursor: pointer;
padding: 3px;
}

.ComboBoxItem_Vista
{
color: #333;
}

.ComboBoxItemHover_Vista
{
color:#fff;
background-color: #39f; 
}

.ComboBoxItemDisabled_Vista
{
color:#666;
cursor: no-drop;
}

.ComboBoxLoadingMessage_Vista
{
font:normal 11px "segoe ui",arial,verdana,sans-serif;
padding: 2px;
}

.ComboBoxMoreResultsMessage_Vista
{
font:normal 11px "segoe ui",arial,verdana,sans-serif;
padding-bottom: 4px;
}

.ComboBoxMoreResultsImage_Vista
{
padding: 5px;
margin: 5px;
}

.ComboBoxMoreResultsBox_Vista
{
background-repeat: no-repeat;
background-position: top center;
border-top: 1px solid #c6c7d2;
cursor: pointer;
color: #999;
}
0
Helen
Telerik team
answered on 24 Jun 2008, 12:59 PM
Hi Kevin,

Did you try the workaround with the fixUp?
Try to execute the following javascript code after the RadComboBox is loaded:

<script type="text/javascript">           
       var combo =<%=RadComboBox1.ClientID%>;         
       combo.FixUp(combo.InputDomElement,true);           
</script>    
 
You may only place the script after the RadComboBox declaration.


Kind regards,
Helen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kevin
Top achievements
Rank 1
answered on 24 Jun 2008, 04:36 PM
That fixed it.

But you know, this reeks of half-ass hack, don't you?


0
Helen
Telerik team
answered on 25 Jun 2008, 07:43 AM

Hello Kevin,

The rendering implementation of the "classic" RadComboBox has some issues which require such hacks. You can check our new RadComboBox which is part from the RadControls for ASP.NET Ajax suite. It utilizes a new rendering implementation which has those resizing issues sorted out.

Regards,

Helen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ComboBox
Asked by
Preetam Ray
Top achievements
Rank 1
Answers by
Helen
Telerik team
Kevin
Top achievements
Rank 1
Share this question
or