Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
210 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
199 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
109 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> 
        <href="#" onclick="update()">Update</a> 
    </form> 
</body> 
</html> 
 

Dimo
Telerik team
 answered on 27 May 2010
3 answers
114 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
81 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
189 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
1 answer
84 views

hi,

I have created a dynamic tab function. When i click button1 it will create dynamic tab and pageview for that tab. But when i deleted that tab that pageview is not deleting. Can any one help me to fix this

HERE IS MY SAMPLE CODE

protected void Button2_Click(object sender, EventArgs e)  
    {  
        Tab currentTab = RadTabStrip1.InnerMostSelectedTab;  
  
        if (currentTab != null)  
        {  
            ITabContainer owner = currentTab.Owner;  
            owner.Tabs.Remove(currentTab);  
            //RadMultiPage1.PageViews.Remove(currentTab.PageView);  
            if (owner.Tabs.Count > 0)  
            {  
                owner.SelectedIndex = 0;  
            }  
        }  
    }  
T. Tsonev
Telerik team
 answered on 27 May 2010
3 answers
364 views
Hi

My grid contain a few data bound columns and one templete column which contain a link button.
At the client side, when a user clicked on (or select) a row I need to find out whether he press the bound columns or the link button, and I need to know the values' of rhe cells in the selected row.

I know how to find the values in the RowSelected event, but I don't know how to find on which column he clicked.

Is there a way to find it ?

Thanks
David

P.S
I'm using RadGrid.Net2.dll Q1 2007 version (file version 5.0.1.0)
Richard
Top achievements
Rank 2
 answered on 27 May 2010
10 answers
109 views
Hi,

This is a question regarding a specific behavior of RadEditor current version for 01/25/2010 (i dont know version number http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx) IE 6.0 and FFox 3.6:

  • Create a simple table (lets say 3x3 for example) using toolbar button
  • Open this new table properties and go to Accessibility tab
  • Input 1 for "Header rows" and close dialog

Behavior i get is : entire first row is deleted from table. Any previous content is lost.

Behavior i expected is : first row html markup changed for <thead><tr><th></th><th></th><th></th></tr></thead> while preserving contents if any.

I'd like to know if the behavior i get is normal or a bug ? If it is normal, how should I proceed to get the behavior I was expecting ?

Thank you !
Rumen
Telerik team
 answered on 27 May 2010
1 answer
82 views
Team

I'm admiring your support given for me(and others) so far.

My company runs with Telerik components since Version 2009.

Since we are implementing your controls one by one in our product, we are stuck with somewhere else.

Right now we are implementing your splitter control in our application.

Our client want the splitter Button should be somewhat bigger (ie. easily catchable). is it Possible?

Pls. provide me your suggestion.

Thanks
Rajesh N.



Bozhidar
Telerik team
 answered on 27 May 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?