Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
210 views
Im trying to setup a AsyncUpload in a UserControl based on the example here .The upload adds a file to the RadUploadTemp folder but never refreshes the image and does not add the image to the permanent folder. Any help would be great.

~Curt 

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TEST.ascx.cs" Inherits="Controls_TEST" %>
<telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Thumbnail" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<script type="text/javascript">
    function fileUploaded(sender, args) {
        $find('RadAjaxManager1').ajaxRequest();
        $telerik.$(".invalid").html("");
        sender.deleteFileInputAt(0);
    }
    function validationFailed(sender, args) {
        $telerik.$(".invalid")
                .html("Invalid extension, please choose an image file");
        sender.deleteFileInputAt(0);
    }
</script>
<div class="upload-panel">
    <telerik:RadBinaryImage runat="server" Width="200px" Height="150px" ResizeMode="Fit"
        ID="Thumbnail" ImageUrl="~/Images/1.jpg" AlternateText="Thumbnail" CssClass="binary-image" />
    <span class="invalid"></span>
    <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" MaxFileInputsCount="1" AllowedFileExtensions="jpeg,jpg,gif,png,bmp"
        TargetFolder="~/Images" TemporaryFolder="~/Images/RadUploadTemp" TemporaryFileExpiration="00:00:05">
        <Localization Select="Choose Avatar" />
    </telerik:RadAsyncUpload>
</div>
Peter Filipov
Telerik team
 answered on 28 Jul 2011
1 answer
39 views
I have a project where I need to have a dynamic ribbon, that is, a ribbon that shows completely different items based on context.  The way I accomplish this is through the LoadXml method on the ribbon.  This works, but there are two side-effects.  One is that the OnButtonClick event returns whatever button was in that position originally, regardless of what's there now, and sometimes there is a jscript index out of bounds error, probably for the same reason.

The version of RadControls is 2011.2.712.40.
The OS is Win7 Ent, SP1.
The browser is IE9 (9.0.8112.16421).
Preferred language is C#.


There's a good amount of code.  I'll include what I think you'll need to repro.  I see the "Attach Your Files" link at the bottom, but the forum instructions say that you don't support attachments.

Here's Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head id="Head1" runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" />
    <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" Skin="Office2007" />
    <telerik:RadAjaxPanel runat="server" ID="RibbonPanel">
    <telerik:RadRibbonBar runat="server" ID="Ribbon" SelectedTabIndex="0" OnButtonClick="RibbonButtonClick">
        <telerik:RibbonBarTab Text="Project">
            <telerik:RibbonBarGroup Text="Project">
                <Items>
                    <telerik:RibbonBarButton Text="Settings" Size="Large" Value="PROJECT_SETTINGS" />
                    <telerik:RibbonBarButton Text="Closeout Assumptions" Size="Large" Value="CLOSEOUT_ASSUMPTIONS" />
                    <telerik:RibbonBarButton Text="View Solution" Size="Large" Value="CLOSEOUT_SOLUTION" />
                </Items>
            </telerik:RibbonBarGroup>
            <telerik:RibbonBarGroup Text="Actions">
                <Items>
                    <telerik:RibbonBarButton Text="Duplicate Project" Size="Large" Value="PROJECT_DUPLICATE" />
                </Items>
            </telerik:RibbonBarGroup>
            <telerik:RibbonBarGroup Text="Navigation">
                <Items>
                    <telerik:RibbonBarButton Text="Portfolio" Size="Large" Value="PORTFOLIO_LIST" />
                </Items>
            </telerik:RibbonBarGroup>
        </telerik:RibbonBarTab>
    </telerik:RadRibbonBar>
    </telerik:RadAjaxPanel>
    </form>
</body>
</html>

Here's Default.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
 
using Tel = Telerik.Web.UI;
 
public partial class Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
        {
        }
    protected void RibbonButtonClick(object sender, Tel.RibbonBarButtonClickEventArgs e)
        {
        string message = string.Format("Button {0} was clicked.", e.Button.Text);
        string details = string.Format("Group: {0}, Index: {1}", e.Group.Text, e.Index);
 
        SlimCommand command = _slimCommands.Where(item => item.Key == e.Button.Value).First();
        Ribbon.LoadXml(command.Ribbon);
        //ContentPanel.Attributes.Add("src", Page.MapPath(command.Destination));
        }
    protected static SlimCommand[] _slimCommands =
        {
            new SlimCommand("PORTFOLIO_LIST", "~/View/ListView.aspx", Ribbons.HomeMenu),
            new SlimCommand("PORTFOLIO_DASHBOARD","~/View/Dashboard.aspx", Ribbons.HomeMenu),
            new SlimCommand("PORTFOLIO_BENCHMARK","~/View/Benchmark.aspx", Ribbons.HomeMenu),
            new SlimCommand("PROJECT_NEW", "~/View/ListView.aspx", Ribbons.HomeMenu),
            new SlimCommand("PROJECT_DELETE", "~/View/ListView.aspx", Ribbons.HomeMenu),
            new SlimCommand("PROJECT_EDIT", "~/View/Project.aspx", Ribbons.ProjectMenu),
            new SlimCommand("PROJECT_SETTINGS", "~/View/Settings.aspx", Ribbons.ProjectMenu),
            new SlimCommand("PROJECT_DUPLICATE", "~/View/ListView.aspx", Ribbons.HomeMenu),
            new SlimCommand("CLOSEOUT_ASSUMPTIONS", "~/View/CloseoutAssumptions.aspx", Ribbons.ProjectMenu),
            new SlimCommand("CLOSEOUT_SOLUTION", "~/View/ViewSolution.aspx", Ribbons.ProjectMenu),
        };
    protected class SlimCommand
        {
        public SlimCommand(string key, string destination, string ribbon)
            {
            this.Key = key;
            this.Destination = destination;
            this.Ribbon = ribbon;
            }
        public string Key { get; private set; }
        public string Destination { get; private set; }
        public string Ribbon { get; private set; }
        }
    }
public enum SlimCommandId
    {
    PORTFOLIO_LIST,
    PORTFOLIO_DASHBOARD,
    PORTFOLIO_BENCHMARK,
    PROJECT_DUPLICATE,
    PROJECT_NEW,
    PROJECT_DELETE,
    PROJECT_EDIT,
    PROJECT_SETTINGS,
    CLOSEOUT_ASSUMPTIONS,
    CLOSEOUT_SOLUTION,
    };


Here's Ribbons.cs
/// <summary>
/// Summary description for Ribbons
/// </summary>
public static class Ribbons
    {
    public const string HomeMenu =
@"<?xml version='1.0' encoding='utf-16'?>
    <RibbonBar EnableAjaxSkinRendering='False'>
    <Tab Text='Portfolio'>
    <Group Text='View'>
      <Button Size='Large' Text='List' Value='PORTFOLIO_LIST' />
      <Button Size='Large' Text='Dashboard' Value='PORTFOLIO_DASHBOARD' />
      <Button Size='Large' Text='Benchmark' Value='PORTFOLIO_BENCHMARK' />
    </Group>
    <Group Text='Project'>
      <Button Size='Large' Text='Create New' Value='PROJECT_NEW' />
      <Button Size='Large' Text='Delete' Value='PROJECT_DELETE' />
      <Button Size='Large' Text='Edit' Value='PROJECT_EDIT' />
      <Button Size='Large' Text='Duplicate' Value='PROJECT_DUPLICATE' />
    </Group>
  </Tab>
</RibbonBar>";
 
    public const string ProjectMenu =
@"<?xml version='1.0' encoding='utf-16'?>
<RibbonBar EnableAjaxSkinRendering='False'>
  <Tab Text='Project'>
    <Group Text='Project'>
      <Button Size='Large' Text='Settings' Value='PROJECT_SETTINGS' />
      <Button Size='Large' Text='Closeout Assumptions' Value='CLOSEOUT_ASSUMPTIONS' />
      <Button Size='Large' Text='View Solution' Value='CLOSEOUT_SOLUTION' />
    </Group>
    <Group Text='Actions'>
      <Button Size='Large' Text='Duplicate Project' Value='PROJECT_DUPLICATE' />
    </Group>
    <Group Text='Navigation'>
      <Button Size='Large' Text='Portfolio' Value='PORTFOLIO_LIST' />
    </Group>
  </Tab>
</RibbonBar>";
    }

Given this, what's the normal way to accomplish dynamic ribbons?

Jamie
Simon
Telerik team
 answered on 28 Jul 2011
3 answers
353 views
Hi,
   I want to call javascript function on dropdown onchange method.
I have a page which contains <telerik:RadWindow> and my dropdown is in telerik:RadWindow.

Please refer bellow code for more details,
MyPage.aspx -
<telerik:RadWindow ID="EditClientDetails" runat="server" DestroyOnClose="true" Title="Edit Client Details"
            VisibleOnPageLoad="false" Behaviors="Minimize, Move" Left="580" Width="860" Height="550"
            Top="-8" EnableShadow="true" Modal="true">
            <ContentTemplate>
                       <table>
                                  <td align="left" valign="top">
                                    <asp:LinqDataSource ID="linqDsContactMode" runat="server" ContextTypeName="DataClassesDataContext"
                                        OrderBy="ContactMode" Select="new (id, ContactMode)" TableName="tbl_client_contactModes">
                                    </asp:LinqDataSource>
                                    <asp:DropDownList ID="ddlContactMode" runat="server" Width="155" CssClass="standard-input"
                                        DataSourceID="linqDsContactMode" DataTextField="ContactMode" DataValueField="id"
                                        AppendDataBoundItems="True" >
                                        <asp:ListItem Value="0" Text="Select"></asp:ListItem>
                                        <asp:ListItem Value="-1" Text="Other" />
                                    </asp:DropDownList>
                                    <br />
                                    <div id="txtOtherContactModeDiv" runat="server" style="margin-top: 5px;">
                                        <telerik:RadTextBox ID="txtOtherContactMode" MaxLength="50"  runat="server" Width="150" BorderColor="#000000" />
                                    </div>
                                </td>
</table>
<div align="center" class="gap">
                        <telerik:RadButton ID="RadBtnUpdate" runat="server" Text="Update" ValidationGroup="EditClient"
                            OnClick="RadBtnUpdate_Click" OnClientClicked="validate">
                        </telerik:RadButton>
</div>
 </ContentTemplate>
        </telerik:RadWindow>

Javascript function in Mypage.aspx-

<telerik:RadScriptBlock ID="rdBlock" runat="server">
    <script type="text/javascript" language="javascript">
        function otherContactModeValidation() {
            var empty = document.getElementById('<%= ddlContactMode.ClientID %>').value; 
            alert(empty);
            if (empty == "-1") {
                document.getElementById('<%= txtOtherContactModeDiv.ClientID %>').style.display = 'block';
            }
            else
            {
                document.getElementById('<%= txtOtherContactModeDiv.ClientID %>').style.display = 'none';
            }
        }
 </script>
</telerik:RadScriptBlock>

Mypage.cs
protected void Page_Load(object sender, EventArgs e)
    
        ddlContactMode.Attributes["onchange"] = "otherContactModeValidation()";
}

Javascript function is not able call on dropdown change.
Please help me...
Abhi
Marin Bratanov
Telerik team
 answered on 28 Jul 2011
2 answers
94 views
I have some issue with the width of Buttons.
In IE doesnt support the width but in FF yes.
I created the Buttons dinamically

like this:

RadRibbonButton newbutton = new RadRibbonButton();
...........
newButton.Width = Unit.Pixel(110)

I attach the 2 views in IE and FF.


Any solution?


Thanks


July
Top achievements
Rank 2
 answered on 28 Jul 2011
1 answer
35 views
It appears as though the HTML for RadWindow gets thrown into the resulting HTML document right after the <form> element, no matter where RadWindow was inserted into the ControlTree. You could argue this doesn't matter because the Window uses absolute positioning and styles don't matter because a skin is set.

However, it matters to us where in the page the actual HTML for the RadWindow ends up. RadWindow has the ability to contain controls, and our control's styles are controlled by where they appear in the page. We need the HTML for RadWindow to appear in the document according to where it is in the control tree, or else the styles for our controls that are placed inside RadWindow will never be applied.
Marin Bratanov
Telerik team
 answered on 28 Jul 2011
3 answers
135 views
hi,
Good Morning!!!

I need to use AccessKey "D" for some functionality in "RadToolBarButton" .

Ex: <telerik:RadToolBarButton  AccessKey="d" ToolTip="Delete">

But    "ALT+ D"  is default shortcut for Windows IE to highlight address bar.

Can any one tell me how to bypass this default feature.

Thanks
Dilip.

Simon
Telerik team
 answered on 28 Jul 2011
1 answer
53 views
Hi all,
i like to know if there's a way to create excpetion in recurrence rule of an appointment starts from another appointment recurrence rule.
I try to explain... In my application user can create different versions of the same object and to each can be associeted a time validity, so i i'm looking for a way to create correct recurrence rule for each object's version that the user creates in case validity overlaps.

Sorry for my horrible english...

Alessio 
Plamen
Telerik team
 answered on 28 Jul 2011
1 answer
101 views
I have a RADComboBox with following.
I databind using code behind. when i click on Footer button i make combobox invisible. I use another button to make this combo box visible. On 2nd button click i re-databind the comboBox but when this happens i loose the Vista Skin.

I tried using the CSS in the header too by copying the ComboBox.Vista.css CSS file to the project still didn't work. Please help . I have also added screen shot

<telerik:RadComboBox ID="radBankAccounts" Runat="server" Width="200px" Skin="Vista"                           
                            HighlightTemplatedItems="true" DataTextField="DisplayAccountName"
                            DataValueField="AccountName"
                            onselectedindexchanged="radBankAccounts_SelectedIndexChanged">
                            <FooterTemplate>
                                <div style="text-align:center">
                                    <asp:LinkButton ID="lnkbtnAddAccount" Text="add new bank account" onclick="hypBtnChangePayAccount_Click" runat="server" />
                                </div>
                            </FooterTemplate>
                        </telerik:RadComboBox>

Dimitar Terziev
Telerik team
 answered on 28 Jul 2011
3 answers
157 views
Hello!!

I have the last version Q2 of the Telerik radcontrols for Asp. Net and i create a Rad Grid with the code bellow, but i want to disable or hide de Add Button control on the lest upper side..How can i do that?

 

 

<telerik:RadGrid id="RadGrid1" runat="server" gridlines="None" allowpaging="True"
            allowsorting="True" autogeneratecolumns="False" width="97%"            
            enableajax="True" CellSpacing="0" DataSourceID="SqlDataSource1" 
            AllowFilteringByColumn="True" onneeddatasource="RadGrid1_NeedDataSource" ShowFooter="True" 
            >  
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>  
                 
            <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                <Selecting AllowRowSelect="True"/>
            </ClientSettings>
                 
            <MasterTableView GridLines="None" Width="100%" 
                CommandItemDisplay ="Top" DataSourceID="SqlDataSource1" >  
                 
                <Columns>  
                    <telerik:GridBoundColumn DataField="SequencialNumber" 
                        HeaderText="SequencialNumber" UniqueName="SequencialNumber" 
                        SortExpression="SequencialNumber">   
                    </telerik:GridBoundColumn>
Shinu
Top achievements
Rank 2
 answered on 28 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?