Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
207 views
Great job Telerik on RadListBox.  We have a couple homegrown alternatives to this and have been hoping you would release this type of control so we could standardize.

One of our current projects relies on multiple combinations of controls created in runtime, after init.  To view these object and their values on postback, we are taking advantage of request.form in the postback and parsing the results.

 Dim str As String 
 Dim str2 As String = "" 
For Each str In Request.Form 
   str2 += str & "  -  " & Request.Form(str) & "<br>"    
Next 
 
Response.Write(str2) 


RadListbox gives us a method of tracing the users actions click by click, but it would be great if the postback could include either the text, or preferably the value, of the RadListboxItem along with the ordinal position changes.  We frequently need to randomize the position of the listitems in these situations to prevent bias so we will currently need to store additional data in hidden controls for the ordinal mapping.  I realize this is not standard usage of the control, but if you could add for future consideration either an ordered list of all values within Radlistbox in request.form (preferable), or include the value in the ordinal move data as it is now, it would streamline the process significantly.

The example beliw is the output of a 4 item list where the last item (3) is placed in position 0 recursively until the list is in it's original position again.

QUIHereType_ClientState - {"logEntries":[{"Type":5,"Index":"3","Data":{"NewIndex":"0"}},{"Type":5,"Index":"3","Data":{"NewIndex":"0"}},{"Type":5,"Index":"3","Data":{"NewIndex":"0"}},{"Type":5,"Index":"3","Data":{"NewIndex":"0"}}],"selectedIndices":[0],"checkedIndices":[],"scrollPosition":0} 



Thanks again for your excellent work with this release.

-Joel

[edit]  subject line should not have included the word viewstate...

Todd
Top achievements
Rank 2
 answered on 19 Nov 2010
3 answers
152 views
Hi,

I've got a really simple situation here that is malfunctioning for some reason..
I've got a RadDatePicker :

<telerik:RadDatePicker ID="datePicker" runat="server" (...) />

And some simple javascript that is running when I press a button:

var datePickerElem = $('#<%= datePicker.ClientID %>').get(0);
var currDate = datePickerElem.get_selectedDate();

The object is found properly, but I get the exception "Microsoft JScript runtime error: Object doesn't support this property or method" when calling get_selectedDate(). Any idea of what's wrong?

BR
Daniel
Telerik team
 answered on 19 Nov 2010
4 answers
233 views
I have a need to either change the forecolor or the backcolor of certain items within a combo box dropdown list. Some may need both applied. I have a default backcolor to white and a default forecolor to black. The dropdown is a list of bills. If one bill contains hazardous cargo then i want the bill number to be red instead of black letters. If the bill is no longer an active bill then i want the change the backcolor of the item to be pink instead of white. If it is an inactive hazardous bill then i want red letters and a pink background to both apply. Changing the forecolor to red is working. Changing the backcolor is not working. The backcolor ends up visually not applying to the proper row. I am setting this within the ItemsRequested event with the code below within the loop that adds the data and binds it to the combo. (attached is a sceenshot of the results, each row where the column == N then the backcolor should be pink)

 

 

string mystatus;

 

mystatus = lBooking.STATUS;

item.Attributes.Add(

 

"STATUS", mystatus);

 

 

 

string myhaz;

 

myhaz = lBooking.HazFlag;

item.Attributes.Add(

 

"HazFlag", myhaz);

 

rcboBookingNum.Items.Add(item);

 

 

if (myhaz=="Y")

 

{

rcboBookingNum.Items[myitemcounter].ForeColor = System.Drawing.

 

Color.Red;

 

}

 

 

if (mystatus == "N")

 

{

rcboBookingNum.Items[myitemcounter].BackColor = System.Drawing.

 

Color.Pink;

 

}

myitemcounter = myitemcounter + 1;




XAML CODE :


 

 

<telerik:RadComboBox ID="rcboBookingNum" runat="server" OnItemsRequested="rcboBookingNum_ItemsRequested"

 

 

 

EnableLoadOnDemand="True" AllowCustomText="True" DropDownWidth="555px" AutoPostBack="True"

 

 

 

OnSelectedIndexChanged="rcboBookingNum_SelectedIndexChanged" ShowDropDownOnTextboxClick="False"

 

 

 

OnClientKeyPressing="OnClientKeyPressingrcboBookingNum"

 

 

 

MaxHeight="150"

 

 

 

Width="120px" Skin="Outlook" HighlightTemplatedItems="false" EnableTheming="False"

 

 

 

CssClass="MainPageCellInputs ForceCaps"

 

 

 

MaxLength="13" TabIndex="1"

 

 

 

MarkFirstMatch="True">

 

 

 

<CollapseAnimation Type="None" />

 

 

 

<HeaderTemplate>

 

 

 

<table width="530px" class="rcbo_tbl10" align="left">

 

 

 

<tr>

 

 

 

<td style="width: 100px" class="dd_col10 dd_head10">

 

Booking Num

 

 

</td>

 

 

 

<td style="width: 230px" class="dd_col10 dd_head10">

 

Ship Name

 

 

</td>

 

 

 

<td style="width: 80px;text-align:center;" class="dd_col10 dd_head10">

 

Status

 

 

</td>

 

 

 

<td style="width: 80px;text-align:center;" class="dd_col10 dd_head10">

 

Hazardous

 

 

</td>

 

 

 

</tr>

 

 

 

</table>

 

 

 

</HeaderTemplate>

 

 

 

<ItemTemplate>

 

 

 

<table width="530px" class="rcbo_tbl10" align="left">

 

 

 

<tr>

 

 

 

<td style="width: 100px" class="dd_col10">

 

<%

 

# DataBinder.Eval(Container, "Text")%>

 

 

 

</td>

 

 

 

<td style="width: 230px" class="dd_col10">

 

<%

 

# DataBinder.Eval(Container, "Attributes['ShipName']") %>

 

 

 

</td>

 

 

 

<td style="width: 80px;text-align:center;" class="dd_col10">

 

<%

 

# DataBinder.Eval(Container, "Attributes['STATUS']")%>

 

 

 

</td>

 

 

 

<td style="width: 80px;text-align:center;" class="dd_col10">

 

<%

 

# DataBinder.Eval(Container, "Attributes['HazFlag']")%>

 

 

 

</td>

 

 

 

</tr>

 

 

 

</table>

 

 

 

</ItemTemplate>

 

 

 

</telerik:RadComboBox>

 


Scott Nolen
Top achievements
Rank 1
 answered on 19 Nov 2010
4 answers
238 views
<script type="text/javascript"> 
function setReadOnly() 
{ 
    var TextBox1 = $find("<%= RadTextBox1.ClientID %>"); 
    TextBox1._textBoxElement.readOnly = state; 
} 
function clearReadOnly() 
{ 
    var TextBox1 = $find("<%= RadTextBox1.ClientID %>"); 
    TextBox1._textBoxElement.readOnly = false; 
} 
 
</script>

Using the above to toggle a textbox readonly flag. Setting back readonly = false and then entering a value into the textbox, upon postback the value is empty.

Question : How to toggle readonly flag client side and make control behave correctly upon postback?

*** Note: Here is the strange part, the control only fails (empty string) on the first postback - after that things work correctly.

More Info: On the first postback - the ReadOnly flag on the server side is false. So setting readonly  to false in java-script did not update something and serverside the flag is still true. I think that why the value is empty.
MarkInTexas
Top achievements
Rank 1
 answered on 19 Nov 2010
6 answers
591 views
hi my dear experts :
i want to show a message in the textbox of RadComboBox When It's Load Like plz Choose an item.
i mean i do not want to have an item with this message as text and i want show the message at radcombobox load.
for this porpose radcombobox shouldn't put the first item as a selected item...
empty message property works when we make an empty item in radcombo box but i don't want an empty item in my list items and do n't let my user to choose an empty item...
Jeremy
Top achievements
Rank 1
 answered on 19 Nov 2010
4 answers
217 views
I'm working on some JavaScript to set the width of the dropdown list for a RadComboBox to the widest item in the list.  Is there a client-side DropDownWidth property I can use for this?  I didn't see any and so I was trying to set the width of the div containing the dropdown (I use the clientid of the RadComboBox with "_DropDown").  But using the following isn't setting the width:

var ddl = document.getElementById("MainContent_RadComboBox1_DropDown");
ddl.style.width = maxWidth + 'px';

maxWidth is the width of the longest item in the droplist.

Thanks for the help!

Sean M. Severson
Sean Severson
Top achievements
Rank 1
 answered on 19 Nov 2010
4 answers
143 views
After panelbar item collapses, controls are still visible for 1-2 seconds. is there anyway to fix it since it make the web app to look very unprofessional.
Attached is a screenshot and here is a snippet:

<telerik:RadPanelBar ID="RadPanelBar1" Runat="server" Skin="Windows7"
           Width="90%"  ExpandMode="SingleExpandedItem" AllowCollapseAllItems="true">
           <Items>
               <telerik:RadPanelItem runat="server" Text="Company" ImagePosition="Right" ImageUrl="Images/Expand.jpg" ExpandedImageUrl="Images/Collapse.jpg"  >
               <Items>
                   <telerik:RadPanelItem>
                   <ItemTemplate>
                        <uc2:ByCompany ID="ByCompany1" runat="server" />
                   </ItemTemplate>
                   </telerik:RadPanelItem>
               </Items>
                
               </telerik:RadPanelItem >
               <telerik:RadPanelItem runat="server" Text="Analyst" ImagePosition="Right" ImageUrl="Images/Expand.jpg" ExpandedImageUrl="Images/Collapse.jpg">
                <Items>
                   <telerik:RadPanelItem>
                   <ItemTemplate>
                   <uc3:ByAnalyst ID="ByAnalyst1" runat="server" />
              </ItemTemplate>
                   </telerik:RadPanelItem>
               </Items>
                
               </telerik:RadPanelItem >



Thanks
Kamen Bundev
Telerik team
 answered on 19 Nov 2010
1 answer
84 views
We have a custom user control that has RadListBoxes.  We populate the RadListboxes with dynamic Templates in the OnIt method.
sample:
override protected void OnInit(EventArgs e)
{
    //
    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
    //
    InitializeComponent();
 
    if (NumberOfColumns == 1)
    {
        ShelfListBox.ItemTemplate = new DefaultListBoxTemplate();
        CartListBox.ItemTemplate = new DefaultListBoxTemplate();
    }
    else if (NumberOfColumns == 2)
    {
        ShelfListBox.ItemTemplate = new TwoColumnListBoxTemplate();
        CartListBox.ItemTemplate = new TwoColumnListBoxTemplate();
    }
    else if (NumberOfColumns == 3)
    {
        ShelfListBox.ItemTemplate = new ThreeColumnListBoxTemplate();
        CartListBox.ItemTemplate = new ThreeColumnListBoxTemplate();
    }
    base.OnInit(e);
}
Right now we have a page that has 6 of our custom control.  
DefaultListBoxTemplate Code:
/// <summary>
/// DefaultListBox ItemTemplate one column
/// </summary>
public class DefaultListBoxTemplate : ITemplate
{
    /// <summary>
    /// Defines the <see cref="T:System.Web.UI.Control"/> object that child controls and templates belong to. These child controls are in turn defined within an inline template.
    /// </summary>
    /// <param name="container">The <see cref="T:System.Web.UI.Control"/> object to contain the instances of controls from the inline template.</param>
    public void InstantiateIn(Control container)
    {
        var label = new Label
                        {
                            ID = "LabelListItem"
                        };
        label.DataBinding += new EventHandler(LabelListItemDataBinding);
        container.Controls.Add(label);
    }
 
    /// <summary>
    /// Handles the DataBinding event of the LabelListItem control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    private static void LabelListItemDataBinding(object sender, EventArgs e)
    {
        var label = (Label)sender;
        var item = (RadListBoxItem)label.BindingContainer;
        var listItemText = DataBinder.Eval(item.DataItem, "Property1") as String;
        label.Text = listItemText;
    }
}

Everything renders correctly on the page, but for some reason in IE7 only, the display of the radlistboxes disappear.  If the page does something on the client side; some of the radlistobxes reappear and some disappear. very strange occurrences in IE7.  Everything works correctly in IE8 or higher, Firefox and chrome.

tried attaching code in zip file...

Version: Telerik.Web.UI 2010.1.309.35
Kamen Bundev
Telerik team
 answered on 19 Nov 2010
4 answers
284 views
Guys,

I have created a stacked bar chart and I want the Series Item label to be shown besides the segment.
As of now it shows above the segment. I played around with the API and found that it can be positioned either inside or outside.
Can I somehow place the text label besides the segment?

Cheers,
Nitin
Ves
Telerik team
 answered on 19 Nov 2010
3 answers
222 views
I have validaiton setup on some of my input controls, and a RadAjaxManagerProxy setup on the page. 

On first page load my validation is working.  But after ajaxifying the page and when the RadAjaxManager refreshes the Ajax content, the validation doesn't work anymore. 

I have read this article (http://www.telerik.com/help/aspnet-ajax/ajxlimitations.html) re. RadAjax and Validators which suggest placing the validation summary in it's own asp:Panel, but it's still not working.

Any ideas?

<asp:Panel ID="validationSummaryPanel" runat="server">
        <asp:ValidationSummary ID="newClientValidationSummary" runat="server" ShowMessageBox="true"
            ShowSummary="false" ValidationGroup="newClientGroup" />
    </asp:Panel>
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="addClientButton">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="leftContainer" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="validationSummaryPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">
    </telerik:RadAjaxLoadingPanel>
Graeme Pickup
Top achievements
Rank 1
 answered on 19 Nov 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?