Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
247 views
I'm trying to style a RADTreeView (Q1 2010)  so that:
  1. The line height is reduced so I can fit a large number of nodes in a limited area
  2. The extra space and padding on the left side of each node is removed
  3. Text wraps with the wrapping text being flush with the text above it

I'm very close but the text wrap isn't working correctly.  When the text wraps, it overlaps with other items in the tree.  See the screen shot - I've highlighted the problem with a red box.

Here is the css I've hacked my way into:

.refinementTreeView .rtLI .rtTop,     
.RadTreeView .rtLI .rtMid,     
.RadTreeView .rtLI .rtBot   
{ height:13px !important;}  
 
.RadTreeView .rtUL   
{ padding-top:0px !important; margin-top:0px !important;}  
 
.RadTreeView .rtUL .rtUL   
{ padding-top:0px !important; margin-top:0px !important; padding-bottom:0px !important; margin-bottom:0px !important; white-space:normal !important;}  
 
.treeView_NoChilds  { padding: 0 !important; font-size: 9px !important;}  
 

.treeView_NoChilds is being applied in the code behind to each tree node via the ContentCssClass property.

The tree itself is inside a div which is inside a table cell with a fixed width.  The tree in the aspx is defined as:

<telerik:RadTreeView ID="treeViewProduct" runat="server" ShowLineImages="False" AppendDataBoundItems="True" DataFieldID="ID" DataFieldParentID="ParentID" > 
 

Each node is output as a html hyperlink for the product name and text as the count.  Any help would be appreciated.  Thanks.

James
Top achievements
Rank 1
 answered on 27 May 2010
6 answers
273 views
There appears to be a bug with the AutoFilter logic when EnableLinqExpressions is set to true.

Lets say I have a string column called "PartnerName", defined as follows:

<

 

telerik:GridBoundColumn DataField="PartnerName" DataType="System.String" HeaderText="Name"

 

 

SortExpression="PartnerName" UniqueName="PartnerName" CurrentFilterFunction="Contains"

 

 

ShowFilterIcon="false" AutoPostBackOnFilter="true" />

 



Lets say the user wants to locate a partner whose name starts with "Briar's".  They enter this text in the filter column, and hit enter.

On the back end, the filter expression is defined within the grid.MasterTableView.FilterExpression is set to:

(iif(PartnerName == null, "", PartnerName).ToString().ToUpper().Contains("briar''s".ToUpper()))

Notice that the grid has replaced the single quote in Briar's with two single quotes.  While this logic makes sense if we're sending the filter expression back to a database directly, it does not make sense when used as part of a Dynamic Linq statement, and in fact results in the query not returning any values..

There doesn't seem to be any way to work around this bug at the moment, short of some invasive string manipulation.  Is there a way to force the grid to not replace the single quote with two single quotes?


Roy
Sebastian
Telerik team
 answered on 27 May 2010
2 answers
56 views
See code below.

The SwapColumns works in all cases.

The expand logic for the group works when the swap columns does not occur.

When the swap columns logic does occur, I loose the expand value and everything is expanded.

Any ideas would be greatly appreciated.

Thanks,
Todd.

 

    protected void ScheduleGrid_PreRender(object sender, EventArgs e)  
    {  
        //Swap  
        if (divisionObj.SwapHomeAndAway)  
            ScheduleGrid.MasterTableView.SwapColumns("Home", "Away");  
 
        //Expand/Collapse groups  
        ArrayList groupItems = new ArrayList(ScheduleGrid.MasterTableView.GetItems(GridItemType.GroupHeader));  
          
        foreach (GridGroupHeaderItem item in groupItems)  
        {  
            bool expanded = false;  
 
            ArrayList childItems = new ArrayList(item.GetChildItems());  
 
            foreach (GridItem child in childItems)  
            {  
                RadComboBox rcb = (RadComboBox)child.FindControl("DispositionComboBox");  
 
                if (rcb != null && rcb.SelectedValue != "")  
                {  
                    if (Convert.ToInt32(rcb.SelectedValue) == DispositionTypes.PENDING)  
                    {  
                        expanded = true;  
                        break;  
                    }  
                }  
 
            }  
 
            item.Expanded = expanded;  
        }  
 
    } 

 

 

Todd A
Top achievements
Rank 1
 answered on 27 May 2010
1 answer
116 views
We have a page in our application in which we allow for uploads of an excel file and then allow for a download of two generated excel files.  In order to make the file upload work without two postbacks we added the enctype code (Me.Page.Form.Enctype = "multipart/form-data").  This fixed the two postbacks and everything seemed to be working in IE but then we found that in Mozilla one of our download buttons was returning a scrambled excel file.  The following is part of the code that assigns the type and file extension to the generated excel file.

Private Const ExcelContentType As String = "application/vnd.ms-excel"
Private Const ExcelFileExtension As String = "xls"

Keep in mind that it completely works in IE, and that one of the buttons is working in Firefox but not the other.
Samuel Davis
Top achievements
Rank 1
 answered on 27 May 2010
4 answers
218 views

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">
    // NOTE - these two functions can be moved to the page
 function StopPropagation(e)
 {
        //cancel bubbling
     e.cancelBubble = true;
  if (e.stopPropagation)
        {
   e.stopPropagation();
  }
 }

 //this method removes the ending character from a string
 function removeLastDelimiter(str)
 {
     var len = str.length;
        if (len > 1)
         return str.substr(0, len - 1);   
     return str;
 }
 function testchange()
 {
     $find("<%= CB1.ClientID %>").set_text("MA5303");
 }
</script>
</telerik:RadScriptBlock>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
     <telerik:RadComboBox ID="CB1" runat="server" Skin="Office2007"
                    AllowCustomText="True" OnItemDataBound="CB1_ItemDataBound"
                    HighlightTemplatedItems="True">
                    <HeaderTemplate>
                        <asp:CheckBox runat="server" ID="SelectAll" />
                        <asp:Label runat="server" ID="hdrLabel" AssociatedControlID="SelectAll">Select All</asp:Label>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <div onclick="StopPropagation(event)">
                            <asp:CheckBox runat="server" ID="chk1" />
                            <asp:Label runat="server" ID="label1" AssociatedControlID="chk1"><%# DataBinder.Eval(Container, "Text") %></asp:Label>
                        </div>
                    </ItemTemplate>
                    <CollapseAnimation Duration="200" Type="OutQuint" />
                </telerik:RadComboBox>
    </div>
    </form>
</body>
</html>


-----------------------------------------------------

private string delimiter = ",";

    public string Delimiter
    {
        get { return delimiter; }
        set { delimiter = value; }
    }
   
    public RadComboBox DDList
    {
        get { return this.CB1; }
    }

    protected override void OnInit(EventArgs e)
    {
        // Create the javascript functions with the client id appended to them.
        StringBuilder sb = new StringBuilder();
        sb.Append(@"<script type='text/javascript'>");
        sb.Append(@"var cancelDropDownClosing");
        sb.Append(CB1.ClientID);
        sb.Append(@"=false; function onDropDownClosing");
        sb.Append(CB1.ClientID);
        sb.Append(@"(){cancelDropDownClosing");
        sb.Append(CB1.ClientID);
        sb.Append(@"= false;}");
        sb.Append(@"function onCheckBoxClick");
        sb.Append(CB1.ClientID);
        sb.Append(@"(){var combo=$find('");
        sb.Append(CB1.ClientID);
        sb.Append(@"');var chkall=$get(combo.get_id() + '_Header_SelectAll');if(AllSelected");
        sb.Append(CB1.ClientID);
        sb.Append(@"()==true){chkall.checked=true;}else{chkall.checked=false;}var text='';var values='';var items=combo.get_items();");
        sb.Append(@"for(var i=0;i<items.get_count();i++){var item=items.getItem(i);var chk1=$get(combo.get_id()+'_i'+i+'_chk1');");
        sb.Append(@"if(chk1.checked){text+=item.get_text()+'");
        sb.Append(Delimiter);
        sb.Append("';values+=item.get_value()+'");
        sb.Append(Delimiter);
        sb.Append("';}}text=removeLastDelimiter(text);values=removeLastDelimiter(values);if(text.length>0){combo.set_text(text);}else{combo.set_text('');}}");
        sb.Append(@"function AnyOneSelected");
        sb.Append(CB1.ClientID);
        sb.Append(@"(){var combo=$find('");
        sb.Append(CB1.ClientID);
        sb.Append(@"');var items=combo.get_items();for(var i=0;i<items.get_count();i++){var item=items.getItem(i);");
        sb.Append(@"var chk1=$get(combo.get_id()+'_i'+i+'_chk1');if(chk1.checked){return true;}}return false;}");
        sb.Append(@"function AllSelected");
        sb.Append(CB1.ClientID);
        sb.Append(@"(){var combo=$find('");
        sb.Append(CB1.ClientID);
        sb.Append(@"');var items=combo.get_items();for(var i=0;i<items.get_count();i++){var item=items.getItem(i);");
        sb.Append(@"var chk1=$get(combo.get_id()+'_i'+i+'_chk1');if(chk1.checked==false){return false;}}return true;}");
        sb.Append(@"function SelectAllClick");
        sb.Append(CB1.ClientID);
        sb.Append(@"(chk){var selectAll=true; if(AnyOneSelected");
        sb.Append(CB1.ClientID);
        sb.Append(@"()==true)selectAll=true;if(AllSelected");
        sb.Append(CB1.ClientID);
        sb.Append(@"()==true)selectAll=false;var text='';var values='';var combo = $find('");
        sb.Append(CB1.ClientID);
        sb.Append(@"');var items=combo.get_items();for(var i=0;i<items.get_count();i++){var item=items.getItem(i);");
        sb.Append(@"var chk1=$get(combo.get_id()+'_i'+i+'_chk1');if(selectAll)chk1.checked=true;else chk1.checked=false;");
        sb.Append(@"if(chk1.checked){text += item.get_text()+'");
        sb.Append(Delimiter);
        sb.Append("';values+=item.get_value()+'");
        sb.Append(Delimiter);
        sb.Append("';}}text=removeLastDelimiter(text);values=removeLastDelimiter(values);if(text.length>0)combo.set_text(text);else ");
        sb.Append(@"combo.set_text('');}</script>");
        string js = sb.ToString();
        // Gets the executing web page
        Page page = HttpContext.Current.CurrentHandler as Page;

        // Register the javascript on the page with the client id appended.
        page.ClientScript.RegisterClientScriptBlock(typeof(_Default), "DDC_" + CB1.ClientID, js);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        // Create the javascript functions.
        if (!this.IsPostBack)
        {
            // Add the events
            this.CB1.OnClientDropDownClosed = "onDropDownClosing" + CB1.ClientID;
            (CB1.Header.FindControl("SelectAll") as CheckBox).Attributes["onclick"] = "SelectAllClick" + CB1.ClientID + "(this)";
            string[] itemsThietBi = { "MA5300", "MA5303", "SAM960", "M41", "IES5K", "IES1K", "T64G", "T160G", "S6506R", "MA5103", "MA5605" };
            CB1.DataSource = itemsThietBi;
            CB1.DataBind();
        }
    }

    protected void CB1_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
    {
        (e.Item.FindControl("chk1") as CheckBox).Attributes["onclick"] = "onCheckBoxClick" + CB1.ClientID + "(this)";
    }

    public string GetCheckBoxValues()
    {
        StringBuilder sbValues = new StringBuilder();
        foreach (Telerik.Web.UI.RadComboBoxItem rcbItem in DDList.Items)
        {
            //If the box is checked return a value
            CheckBox cb = (CheckBox)rcbItem.FindControl("chk1");
            if (null != cb && cb.Checked)
            {
                sbValues.Append(rcbItem.Text);
                sbValues.Append(Delimiter);
            }
        }
        //Remove Trailing comma
        string str = sbValues.ToString();
        if (str.EndsWith(Delimiter))
            return str.Remove(sbValues.Length - 1, 1);
        return str;
    }

    public void SetCheckBoxValues(string csv)
    {
        // First clear all checks.
        foreach (RadComboBoxItem item in DDList.Items)
        {
            CheckBox chkbox = (CheckBox)item.FindControl("chk1");
            if (null != chkbox)
                chkbox.Checked = false;
        }

        // Find each item in the list and set the check and combo text value.
        string[] values = csv.Split(',');
        string text = string.Empty;
        for (int i = 0; i <= values.Length - 1; i++)
        {
            RadComboBoxItem item = DDList.FindItemByValue(values[i]);
            CheckBox chkbox = (CheckBox)item.FindControl("chk1");
            if (text.Equals(string.Empty))
                text = string.Format("{0}", item.Text);
            else
                text = string.Format("{0}{1} {2}", text, Delimiter, item.Text);
            chkbox.Checked = true;
        }
        DDList.Text = text;     // This doesn't do anything!
    }

How to use javascript to set select items?

Thanks,

Megan Vee
Top achievements
Rank 1
 answered on 27 May 2010
1 answer
206 views
Hi,

I have three radgrids on three different usercontrols with the exact same Skin on them. Which was set to outlook skin.

All three grids were working great until one day totally unexpectedly i was modifying the code behind of the main page which holds the user controls, and the style on one of the grids completely disappeared. I must stress that i did not do anything to do with skins in the code behind what so ever.

The other two grids still have the style outlook. I dont have a clue what has gone wrong. This is the grid in question below that is not showing the skin.

<

 

telerik:RadGrid ID="radgrid" Skin="Outlook" OnInsertCommand="radgrid_InsertCommand"

 

 

OnUpdateCommand="radgrid_UpdateCommand" EnableEmbeddedSkins="false" OnDeleteCommand="radgrid_OnDeleteCommand"

 

 

OnNeedDataSource="radgrid_NeedDataSource" OnDetailTableDataBind="radgrid_DetailTableDataBind"

 

 

runat="server">

 

 

    <MasterTableView AutoGenerateColumns="false" Name="Acc" DataKeyNames="Id"

 

 

        CommandItemDisplay="Bottom">

 

 

        <DetailTables>

 

 

            <telerik:GridTableView Name="Comm" DataKeyNames="Id2" CommandItemDisplay="Bottom"

 

 

                AutoGenerateColumns="false" Width="100%">

 

 

            <Columns>

 

 

                <telerik:GridBoundColumn HeaderText="" DataField="Id" UniqueName="Id"

 

 

                    Visible="false">

 

 

                </telerik:GridBoundColumn>

 

 

                <telerik:GridBoundColumn HeaderText="name" DataField="param">

 

 

                </telerik:GridBoundColumn>

 

 

                <telerik:GridBoundColumn HeaderText="name" DataField="param" DataFormatString="{0:N2}%">

 

 

                </telerik:GridBoundColumn>

 

 

                <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Update" UniqueName="EditCommandColumn1"

 

 

                    EditImageUrl="Edit.gif">

 

 

                    <HeaderStyle Width="20px" />

 

 

                    <ItemStyle CssClass="MyImageButton" HorizontalAlign="Center" />

 

 

                </telerik:GridEditCommandColumn>

 

 

                <telerik:GridTemplateColumn UniqueName="DeleteColumn" HeaderText="Delete">

 

 

                    <HeaderStyle Width="20px" />

 

 

                    <ItemTemplate>

 

 

                        <div style="width: 6px; max-width: 6px">

 

 

                            <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="Delete.gif"

 

 

                                    AlternateText="Delete" OnClientClick="return confirmFn();" />

 

 

                        </div>

 

 

                    </ItemTemplate>

 

 

                    <ItemStyle HorizontalAlign="Center" />

 

 

                </telerik:GridTemplateColumn>

 

 

            </Columns>

 

 

            <EditFormSettings UserControlName="CommEditForm.ascx" EditFormType="WebUserControl">

 

 

            </EditFormSettings>

 

 

        </telerik:GridTableView>

 

 

    </DetailTables>

 

 

    <Columns>

 

 

        <telerik:GridBoundColumn HeaderText="name" DataField="Param">

 

 

        </telerik:GridBoundColumn>

 

 

        <telerik:GridBoundColumn HeaderText="name" DataFormatString="{0:N2}" DataField="Param">

 

 

        </telerik:GridBoundColumn>

 

 

        <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderText="Update" UniqueName="EditCommandColumn1"

 

 

            EditImageUrl="Edit.gif">

 

 

            <HeaderStyle Width="20px" />

 

 

            <ItemStyle CssClass="MyImageButton" HorizontalAlign="Center" />

 

 

        </telerik:GridEditCommandColumn>

 

 

        <telerik:GridTemplateColumn UniqueName="DeleteColumn" HeaderText="Delete">

 

 

            <HeaderStyle Width="20px" />

 

 

            <ItemTemplate>

 

 

                <div style="width: 6px; max-width: 6px">

 

 

                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="Delete.gif"

 

 

                        AlternateText="Delete" OnClientClick="return confirmFn();" />

 

 

                </div>

 

 

            </ItemTemplate>

 

 

            <ItemStyle HorizontalAlign="Center" />

 

 

        </telerik:GridTemplateColumn>

 

 

    </Columns>

 

 

    <EditFormSettings UserControlName="AccEditForm.ascx" EditFormType="WebUserControl">

 

 

    </EditFormSettings>

 

 

    </MasterTableView>

 

 

</telerik:RadGrid>

 

Dimo
Telerik team
 answered on 27 May 2010
2 answers
114 views
I've run into an interesting issue and hoping someone can shed some light.

I have a radNumericTextBox that has its value being validated and changed if invalid via set_textboxvalue function. The set_textboxvalue is working fine, however I found that if you click back in the textbox the value will return to what it was originally. What's causing this?

Using version 2008.1.515.20

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="sandbox.aspx.vb" Inherits="test_sandbox" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title>Untitled Page</title> 
    <script> 
    function update() { 
    $find('radTbQty').set_textBoxValue('1000'); 
    } 
    </script> 
</head> 
<body> 
    <form id="form1" runat="server"> 
        <rad:RadScriptManager ID="RadScriptManager1" runat="server"> 
        </rad:RadScriptManager> 
        <rad:RadNumericTextBox ID="radTbQty" CssClass="txtbox" Width="30px" MinValue="1" 
            MaxValue="4000" MaxLength="4" NumberFormat-DecimalDigits="0" Value="1" runat="server"> 
        </rad:RadNumericTextBox> 
        <a href="#" onclick="update()">Update</a> 
    </form> 
</body> 
</html> 
 

Dimo
Telerik team
 answered on 27 May 2010
3 answers
120 views
hi

in right to left language Currency should show in left   bu in rad input show in right


Note:
ریال mean as $

Dimo
Telerik team
 answered on 27 May 2010
1 answer
84 views
I have two RadWindows side-by-side within a RadWindowManager. Both windows can be resized and moved, and are populated (say with some static html page). When I resize or move one of the windows by dragging the borders or titlebar, the other window that doesn't have focus blanks out for the duration of the drag. The contents reappear only when the resize/move operation is completed on the first window.

Can this behavior be modified, so that contents of the second window are visible even while the first window is being resized/moved?

I'm using version 2010.1.309.20, and my IDE is VS 2008, with .NET 3.5 SP1. The browser being used is IE 6.0.

Here is the body of my page:

<body>    
    <form id="form1" runat="server">     
    <div>         
        <asp:ScriptManager ID="ScriptManager1" runat="server">     
        </asp:ScriptManager>    
         
    <telerik:RadWindowManager ID="DBRadWindowManager" runat="server">     
        <Windows>    
            <telerik:RadWindow ID="CustomerWindow" runat="server" VisibleOnPageLoad="true" TabIndex="1" ReloadOnShow="true"    
                BorderStyle="None" Behavior="Default" Height="250px" InitialBehavior="None" Left="5px"      
                Skin="Telerik" Title="CUSTOMER" Top="20px" Width="300px" NavigateUrl="Source1.htm"      
                Behaviors="Maximize,Minimize,Move,Reload,Resize" KeepInScreenBounds="true">     
            </telerik:RadWindow>    
            <telerik:RadWindow ID="OrderWindow" runat="server" VisibleOnPageLoad="True" TabIndex="2" ReloadOnShow="true"    
                BorderStyle="None" Behavior="Default" Height="250px" InitialBehavior="None" Left="400px"    
                Skin="Telerik" Title="ORDERS" Top="20px" Width="300px" NavigateUrl="Source2.htm"    
                Behaviors="Maximize,Minimize,Move,Reload,Resize" KeepInScreenBounds="true">     
            </telerik:RadWindow>    
        </Windows>    
    </telerik:RadWindowManager>    
    </div>    
    </form>    
</body>    
 
Petio Petkov
Telerik team
 answered on 27 May 2010
4 answers
196 views
I'm in the middle of upgrading process from RadControls ASP.NET Q2 2007 to Asp.Net Ajax Q1 2010. One of my issues I'm facing now is, my popup radwindow in maximized mode doesn't resize when I resize the browser in Q1 2010. It's working though in my old Q2 07.

Here is the code in Q2 07,

<radW:RadWindowManager ID="RadWindowManager1" VisibleStatusbar="False" ShowContentDuringLoad="False" runat="server" Left="" SkinsPath="~/RadControls/Window/Skins" Title="" Top="">
        <Windows>
            <radW:RadWindow ID="winEdit" SkinsPath="~/RadControls/Window/Skins/Default" Modal="True" Height="600px" Width="1000px" VisibleStatusbar="False" runat="server" Title="Loading..." />
        </Windows>
    </radW:RadWindowManager>


in Q1 2010,

<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    <Windows>
        <telerik:RadWindow ID="winEdit" runat="server" InitialBehaviors="Maximize" KeepInScreenBounds="true" Behaviors="Reload,Minimize,Maximize,Resize,Close" Modal="true" VisibleStatusbar="false" ShowContentDuringLoad="false" ReloadOnShow="true" Title="Loading..." Skin="WebBlue" />
    </Windows>
</telerik:RadWindowManager>


and both have the same javascript function to pop the window,

<script type="text/javascript">
function ShowWindow( url,winId ) {
    var x = window.radopen(url, winId);
    x.Maximize(); 
    return false;
}
</script>

Help!
Petio Petkov
Telerik team
 answered on 27 May 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?