Telerik Forums
UI for ASP.NET AJAX Forum
20 answers
238 views
Just go the the radcombobox demos with IE8, switch to compatibility view and you will see a line under the text area(most skins) and the drop down arrow (some skins). Seems not to happen at all for some skins. Use Vista skin and you'll see it.

Doesn't happen on IE6, IE7 or FF.

Mihir Pathak
Top achievements
Rank 1
 answered on 09 Mar 2010
4 answers
387 views
I have seen a similar issue and client side solution for clearing the Telerik date picker on this forum, but for a dynamically added date picker I can't see the solution. The scenario is the following:
I have a grid where in each row a date picker sits with a clear button to remove the selected date. The grid is built from scratch in code behind and thus the client side clear action script must know which date picker to clear for each grid row.
I ttried to build the script as a string and adding to each grid row as a literal:

dpExpiryDatePicker = new Telerik.WebControls.RadDatePicker();
dpExpiryDatePicker.ID = "dpExpiryDatePicker_" + nCount;
dpExpiryDatePicker.ToolTip = "Select the date";
dpExpiryDatePicker.Width = Unit.Pixel(90);
dpExpiryDatePicker.MinDate = DateTime.Now.Date.AddDays(1);


"<script>" +
"function ClearExpiryDate()" +
"{" +
"   var dpDatePicker = <%=" + dpExpiryDatePicker.ClientID+ "%>;" +
//    "var dpDatePicker = $find(\"<%=" + dpExpiryDatePicker.ClientID+ "%>\");" +
"alert(dpDatePicker);" +
"if(dpDatePicker != null)" +
"{" +
"   dpDatePicker.DateInput.Clear();" +
"}" +
"}" +
"</script>";

Can someone point out how to handle the clearing of each date picker added dynamically? Unfortunately the script above doesn't work, neither work the other commented out line. So how to achieve this?

Benjamin
Top achievements
Rank 1
 answered on 09 Mar 2010
4 answers
200 views
I have a menu which has parent, children and grandchildren levels.  If a child has children, then when that child is hovered, a right arrow image should appear on the right side of the child.  This works great in all browsers except IE6.  In IE6, the image doesn't appear at all.  I've enclosed my code below.  Any help would be greatly appreciated.  Thank you.

Here's the code in question:
.RadMenu_NavBlue .rmGroup .rmItem:hover .rmExpandRight 
{ 
    background:url(menu/bluearrow.gif) no-repeat rightright; 
} 

And here's the entire stylesheet:
/* <RadMenu / Black> */ 
 
.RadMenu_NavBlue .rmRootGroup 
{ 
    height: 30px; 
} 
 
.RadMenu_NavBlue .rmRootGroup .rmItem 
{ 
    height: 100%; 
    text-align: center; 
    width: 151px; 
} 
 
.RadMenu_NavBlue .rmRootGroup .rmFirst 
{ 
    border-left: none; 
} 
 
.RadMenu_NavBlue .rmRootGroup .rmLast 
{ 
    border-right: none; 
} 
 
.RadMenu_NavBlue .rmRootGroup .rmLink 
{ 
    height: 30px; 
    -moz-box-sizing: content-box; 
    background: url(Menu/grad_darkblue.PNG) repeat-x; 
    font: bold 12px Trade Gothic Condensed; 
    text-decoration: none; 
    color: White; 
    text-align: center; 
    text-transform: uppercase; 
} 
 
.RadMenu_NavBlue .rmRootGroup .rmLink:hover 
{ 
    background: #00447D; 
    cursor: pointer; 
} 
 
.RadMenu_NavBlue .rmExpanded 
{ 
    background: #00447D; 
} 
 
.RadMenu_NavBlue .rmVertical 
{ 
    background-position: 0 -408px; 
} 
 
/* <Root items> */ 
 
.RadMenu_NavBlue .rmItem 
{ 
    padding: 0; 
} 
 
.RadMenu_NavBlue .rmLink:hover 
{ 
    cursor: pointer; 
} 
 
.RadMenu_NavBlue .rmLink, 
.RadMenu_NavBlue .rmText 
{ 
    background-repeat: no-repeat; 
    background-position: 0 500px; 
    float: none; 
    text-align: center; 
} 
 
.RadMenu_NavBlue .rmLink:hover, 
.RadMenu_NavBlue .rmFocused, 
.RadMenu_NavBlue .rmSelected 
{ 
    background-position: 0 -72px; 
} 
 
.RadMenu_NavBlue .rmExpanded, 
.RadMenu_NavBlue .rmExpanded:hover 
{ 
    background-position: 0 -72px; 
} 
 
.RadMenu_NavBlue .rmExpanded .rmText, 
.RadMenu_NavBlue .rmExpanded:hover .rmText 
{ 
    background-position: 100% -96px; 
} 
 
.RadMenu_NavBlue .rmLast .rmExpanded .rmText 
{ 
    background-position: 0 500px; 
    background-repeat: no-repeat; 
} 
 
.RadMenu_NavBlue .rmDisabled, 
.RadMenu_NavBlue .rmDisabled:hover 
{ 
    color: #7d7d7d; 
    background-position: 0 500px; 
} 
 
/* </Root items> */ 
 
 
/* <Submenu items> */ 
.RadMenu_NavBlue .rmGroup, 
.RadMenu_NavBlue .rmGroup .rmVertical 
{ 
    border: 1px solid white; 
    background: #E8E8E8; 
    font: normal Arial 10px !important; 
} 
 
.RadMenu_NavBlue .rmVertical .rmItem 
{ 
    border-left: none; 
    border-bottom: solid 1px white; 
    border-right: none; 
    height: auto; 
    width: 100%; 
} 
 
.RadMenu_NavBlue .rmGroup .rmFirst 
{ 
    border-top: none; 
} 
 
.RadMenu_NavBlue .rmGroup .rmLast 
{ 
    border-bottom: none; 
} 
 
.RadMenu_NavBlue .rmSlide .rmLink 
{ 
    padding: 2px 7px 2px 2px !important; 
    color: #013368; 
    height: 100%; 
    width: 142px; 
    font-weight: normal; 
    font-family: Arial; 
    font-size: 10px; 
    text-transform: none; 
} 
 
.RadMenu_NavBlue .rmGroup .rmVertical .rmLink .rmText 
{ 
     
} 
 
.RadMenu_NavBlue .rmGroup .rmLink:hover 
{ 
    background: white; 
} 
 
.RadMenu_NavBlue .rmSlide .rmGroup .rmText 
{ 
    text-align: left; 
} 
 
.RadMenu_NavBlue .rmSlide .rmScrollWrap 
{ 
    background-image: none; 
} 
 
.RadMenu_NavBlue_rtl .rmGroup, 
.RadMenu_NavBlue_rtl .rmGroup .rmVertical 
{ 
    background-position: 100% 0; 
} 
 
.RadMenu_NavBlue .rmRootGroup .rmHorizontal 
{ 
    background-image: none; 
} 
 
.RadMenu_NavBlue .rmScrollWrap .rmVertical 
{ 
    border: 0; 
} 
 
.RadMenu_NavBlue .rmGroup .rmLink, 
.RadMenu_NavBlue .rmGroup .rmText, 
.RadMenu_NavBlue .rmGroup .rmItem .rmDisabled, 
.RadMenu_NavBlue .rmGroup .rmItem .rmDisabled:hover, 
.RadMenu_NavBlue .rmGroup .rmItem .rmDisabled .rmText, 
.RadMenu_NavBlue .rmGroup .rmItem .rmDisabled:hover .rmText 
{ 
    background-position: 0 500px; 
    background-repeat: no-repeat; 
    background-color: transparent; 
} 
 
.RadMenu_NavBlue .rmGroup .rmLink:hover, 
.RadMenu_NavBlue .rmGroup .rmFocused, 
.RadMenu_NavBlue .rmGroup .rmSelected, 
.RadMenu_NavBlue .rmGroup .rmExpanded 
{ 
    background-position: 0 -168px; 
} 
 
 
 
.RadMenu_NavBlue .rmGroup .rmLink:hover .rmText, 
.RadMenu_NavBlue .rmGroup .rmFocused .rmText, 
.RadMenu_NavBlue .rmGroup .rmSelected .rmText, 
.RadMenu_NavBlue .rmGroup .rmExpanded .rmText 
{ 
    background-position: 100% -192px; 
} 
 
/* <expand arrows> */ 
 
.RadMenu_NavBlue .rmGroup .rmExpandRight, 
.RadMenu_NavBlue .rmGroup .rmExpandDown, 
.RadMenu_NavBlue .rmGroup .rmItem .rmDisabled .rmExpandRight, 
.RadMenu_NavBlue .rmGroup .rmItem .rmDisabled .rmExpandDown, 
.RadMenu_NavBlue .rmGroup .rmItem .rmDisabled:hover .rmExpandRight, 
.RadMenu_NavBlue .rmGroup .rmItem .rmDisabled:hover .rmExpandDown 
{ 
    background-position: 100% -216px; 
} 
 
.RadMenu_NavBlue .rmGroup .rmItem:hover .rmExpandRight 
{ 
    background:url(menu/bluearrow.gif) no-repeat rightright; 
} 
 
.RadMenu_NavBlue .rmGroup .rmFocused .rmExpandRight, 
.RadMenu_NavBlue .rmGroup .rmSelected .rmExpandRight, 
.RadMenu_NavBlue .rmGroup .rmExpanded .rmExpandRight, 
.RadMenu_NavBlue .rmGroup .rmLink:hover .rmExpandDown, 
.RadMenu_NavBlue .rmGroup .rmFocused .rmExpandDown, 
.RadMenu_NavBlue .rmGroup .rmSelected .rmExpandDown, 
.RadMenu_NavBlue .rmGroup .rmExpanded .rmExpandDown 
{ 
    background-position: 100% -240px; 
} 
 
.RadMenu_NavBlue .rmGroup .rmDisabled:hover .rmExpandRight, 
.RadMenu_NavBlue .rmGroup .rmDisabled:hover .rmExpandDown 
{ 
    background-image: url('Menu/rmSprite.png'); 
    background-position: 100% -216px; 
} 
 
/* </expand arrows> */ 
 
/* <rtl> */ 
 
.RadMenu_NavBlue_rtl .rmVertical .rmExpanded .rmText, 
.RadMenu_NavBlue_rtl .rmVertical .rmExpanded:hover .rmText 
{ 
    background-position: 0 500px; 
    background-repeat: no-repeat; 
} 
 
.RadMenu_NavBlue_rtl .rmGroup .rmLink:hover, 
.RadMenu_NavBlue_rtl .rmGroup .rmFocused, 
.RadMenu_NavBlue_rtl .rmGroup .rmSelected, 
.RadMenu_NavBlue_rtl .rmGroup .rmExpanded 
{ 
    background-position: 100% -264px; 
} 
 
.RadMenu_NavBlue_rtl .rmGroup .rmLink:hover .rmText, 
.RadMenu_NavBlue_rtl .rmGroup .rmFocused .rmText, 
.RadMenu_NavBlue_rtl .rmGroup .rmSelected .rmText, 
.RadMenu_NavBlue_rtl .rmGroup .rmExpanded .rmText 
{ 
    background-position: 0 -288px; 
} 
 
.RadMenu_NavBlue_rtl .rmGroup .rmExpandLeft 
{ 
    background-position: 0 -312px; 
} 
 
.RadMenu_NavBlue_rtl .rmGroup .rmLink:hover .rmExpandLeft, 
.RadMenu_NavBlue_rtl .rmGroup .rmFocused .rmExpandLeft, 
.RadMenu_NavBlue_rtl .rmGroup .rmSelected .rmExpandLeft, 
.RadMenu_NavBlue_rtl .rmGroup .rmExpanded .rmExpandLeft 
{ 
    background-position: 0 -336px; 
} 
 
/* </rtl> */ 
 
/* </Submenu items> */ 
 
/* <Submenu offsets (Black - specific, overlapping submenus)> */ 
 
.RadMenu_NavBlue .rmSlide 
{ 
    margin: 0 0 0 -1px; 
} 
 
.RadMenu_NavBlue .rmVertical .rmSlide, 
.RadMenu_NavBlue .rmSlide .rmSlide, 
.RadMenu_NavBlue_Context .rmGroup .rmSlide 
{ 
    margin: 0 0 0 -5px; 
} 
 
.RadMenu_NavBlue_rtl .rmSlide 
{ 
    margin: 0 0 0 0; 
} 
 
.RadMenu_NavBlue_rtl .rmVertical .rmSlide, 
.RadMenu_NavBlue_rtl .rmSlide .rmSlide, 
.RadMenu_NavBlue_Context_rtl .rmGroup .rmSlide 
{ 
    margin: 0 0 0 5px; 
} 
 
/* </Submenu offsets> */ 
 
/* <Scrolling arrows> */ 
 
.RadMenu_NavBlue .rmLeftArrow, 
.RadMenu_NavBlue .rmRightArrow 
{ 
    background-color: #4f4f4f; 
} 
 
.RadMenu_NavBlue .rmLeftArrow { background-position: -8px -312px; border-right: 1px solid #828282; } 
.RadMenu_NavBlue .rmRightArrow { background-position: -482px -216px; border-left: 1px solid #828282; } 
 
.RadMenu_NavBlue .rmTopArrow, 
.RadMenu_NavBlue .rmBottomArrow, 
.RadMenu_NavBlue .rmGroup .rmLeftArrow, 
.RadMenu_NavBlue .rmGroup .rmRightArrow 
{ 
    background-color: #4f4f4f; 
} 
 
.RadMenu_NavBlue .rmTopArrow { background-position: 50% -367px; border-bottom: 1px solid #828282; } 
.RadMenu_NavBlue .rmBottomArrow { background-position: 50% -391px; border-top: 1px solid #828282; } 
 
/* </Scrolling arrows> */ 
 
/* <Separators> */ 
 
.RadMenu_NavBlue .rmHorizontal .rmSeparator .rmText, 
.RadMenu_NavBlue .rmVertical .rmHorizontal .rmSeparator .rmText 
{ 
    height: 22px; 
    margin: 1px 0 0; 
    width: 1px; 
    background-color: #000; 
} 
 
.RadMenu_NavBlue_Context .rmSeparator .rmText, 
.RadMenu_NavBlue .rmHorizontal .rmGroup .rmSeparator .rmText, 
.RadMenu_NavBlue .rmVertical .rmHorizontal .rmGroup .rmSeparator .rmText 
{ 
    background-color: transparent; 
    background-position: 0 -406px; 
} 
 
/* </Separators> */ 
 
/* </RadMenu / Black> */ 

Brad H
Top achievements
Rank 2
 answered on 09 Mar 2010
2 answers
84 views
Dear,

We want to insert a greece charakter Sigma (Σ) into the editor, we've used hexdecimal value of HTML 4.0: #x931; This displays the charakter we wants but when switching between HTML and DESIGN modes, the HTML code will be stripped and replaced with a normal charakter (Σ) in both modes. This will be stripped to a normal S or ? while saving the content to database. When i save the content from HTML mode, this will save the correct hexdemical HTML code.

We've tried to change the meta tag for Contenttype to ISO-8859-7 for greece charakters but this don't works. And also we've tried other hexdecimal HTML codes and other charsets. And also we've turned off the ConvertToXhtml filter.

It looks this will happens when switching from HTML mode to DESIGN mode.

Is this a bug or i'm doing something wrong?
We're using Telerik ASP.NET Q3 2009, this issue will also happen in older version Q3 2008.

Very much thanks,

Jelle de Boer
Software Development
Erick
Top achievements
Rank 2
 answered on 09 Mar 2010
19 answers
401 views
Hi,
I have an application that uses the RADprogress Manager.  On my dev machine, it works fine, during the file upload the progress bar appears and updates.  I move the application to my production server and the file uploads but no progress area.  In reviewing the forums and other support, I've done/checked the following
- Ensure the two registrations are in web.config (the prod srv is the same - I just change the connection string after I load it)
- No Ajax
- tried setting trust level="Full"
- updated to latest assemblies

I did not try registering the assembly in the GAC, as I run several other website on the server and was uncertain of the effect on them.

The production server is windows 2003 with IE 6.  It is a dedicated server, not shared.  The browser is IE 8.  My dev environment is Windows XP, Visual Studio 2008.

The only two differences I can see beyond the OS difference is that on the produciton server, the website runs as a Virtual Directory under a second website that does not have the appropriate registrations in the web.config.  I didn't purse that further since upload works.  I assume that wouldn't work if it wasn't  seeing the registrations
The other difference is the production server is running dotDefender as an application firewall.  That firewall has not caused any other code issues..

Thanks for you help,
Bob

Genady Sergeev
Telerik team
 answered on 09 Mar 2010
1 answer
167 views
Hi,

I'm trying to use some combo boxes in a custom control.  To get this working I am using AJAX and have a function that I call in the custom control backend that ties the AJAXified controls to the main page's AjaxManager.  This works for the radnumerictextbox controls on the page but for the radcombobox controls the selected index changed event doesn't fire.  If I take the controls out of the custom control and run them in a standard web page it works fine.  Any ideas?  Code is below:

Custom control webpage:
    <tr> 
        <td class="label">Start Date Modifier:</td> 
        <td class="halfWidth">  
            <telerik:RadNumericTextBox ID="uxStartDateModInterval" runat="server" Width="30" DataType="System.Int16" MaxValue="100" MinValue="-100" AutoPostBack="True" ><NumberFormat DecimalDigits="0" /></telerik:RadNumericTextBox> 
            &nbsp;  
            <telerik:RadComboBox ID="uxStartDateModIntervalTypeID" Runat="server" Width="90" MarkFirstMatch="True" AutoPostBack="True" OnSelectedIndexChanged="uxStartDateModIntervalTypeID_SelectedIndexChanged">  
                <Items> 
                    <telerik:RadComboBoxItem runat="server" Text="Day(s)" Value="1" /> 
                    <telerik:RadComboBoxItem runat="server" Text="Week(s)" Value="2" /> 
                    <telerik:RadComboBoxItem runat="server" Text="Month(s)" Value="3" /> 
                    <telerik:RadComboBoxItem runat="server" Text="Quarter(s)" Value="4" /> 
                    <telerik:RadComboBoxItem runat="server" Text="Year(s)" Value="5" /> 
                </Items> 
            </telerik:RadComboBox> 
        </td> 
        <td class="labelBlackLeft" colspan="2">  
            <asp:label ID="uxStartDateExample" runat="server" Text="Ensure both fields have data."></asp:label> 
        </td> 
    </tr> 
    <tr> 
        <td class="label">End Date Modifier:</td> 
        <td class="halfWidth">  
            <telerik:RadNumericTextBox ID="uxEndDateModInterval" runat="server" Width="30" DataType="System.Int16" MaxValue="100" MinValue="-100" AutoPostBack="True" ><NumberFormat DecimalDigits="0" /></telerik:RadNumericTextBox> 
            &nbsp;  
            <telerik:RadComboBox ID="uxEndDateModIntervalTypeID" Runat="server" Width="90" MarkFirstMatch="True" AutoPostBack="True" OnSelectedIndexChanged="uxEndDateModIntervalTypeID_SelectedIndexChanged">  
                <Items> 
                    <telerik:RadComboBoxItem runat="server" Text="Day(s)" Value="1" /> 
                    <telerik:RadComboBoxItem runat="server" Text="Week(s)" Value="2" /> 
                    <telerik:RadComboBoxItem runat="server" Text="Month(s)" Value="3" /> 
                    <telerik:RadComboBoxItem runat="server" Text="Quarter(s)" Value="4" /> 
                    <telerik:RadComboBoxItem runat="server" Text="Year(s)" Value="5" /> 
                </Items> 
            </telerik:RadComboBox> 
        </td> 
        <td class="labelBlackLeft" colspan="2">  
            <asp:label ID="uxEndDateExample" runat="server" Text="Ensure both fields have data."></asp:label> 
        </td> 
    </tr> 

Custom control codebehind
        Public Sub SetupAJAX(ByRef radAjaxManager As Telerik.Web.UI.RadAjaxManager)  
            radAjaxManager.AjaxSettings.AddAjaxSetting(Me.uxStartDateModInterval, Me.uxStartDateExample)  
            radAjaxManager.AjaxSettings.AddAjaxSetting(Me.uxStartDateModIntervalTypeID, Me.uxStartDateExample)  
            radAjaxManager.AjaxSettings.AddAjaxSetting(Me.uxEndDateModInterval, Me.uxEndDateExample)  
            radAjaxManager.AjaxSettings.AddAjaxSetting(Me.uxEndDateModIntervalTypeID, Me.uxEndDateExample)  
        End Sub 
 
        Protected Sub uxStartDateModIntervalTypeID_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles uxStartDateModIntervalTypeID.SelectedIndexChanged  
            ModifyDate(uxStartDateModInterval, uxStartDateModIntervalTypeID, uxStartDateExample, False)  
        End Sub 
 
        Protected Sub uxEndDateModIntervalTypeID_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles uxEndDateModIntervalTypeID.SelectedIndexChanged  
            ModifyDate(uxEndDateModInterval, uxEndDateModIntervalTypeID, uxEndDateExample, False)  
        End Sub 
 
        Protected Sub uxStartDateModInterval_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles uxStartDateModInterval.TextChanged  
            ModifyDate(uxStartDateModInterval, uxStartDateModIntervalTypeID, uxStartDateExample, False)  
        End Sub 
 
        Protected Sub uxEndDateModInterval_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles uxEndDateModInterval.TextChanged  
            ModifyDate(uxEndDateModInterval, uxEndDateModIntervalTypeID, uxEndDateExample, False)  
        End Sub 

Finally on the page that has the custom control placed on it I use the following in the Page_Load event...

uxDateModifierControl.SetupAJAX(uxRadAjaxManager) 

Where uxDataModifierControl is the custom control ID....

Any thoughts?

Regards,

Jon



Jon
Top achievements
Rank 1
 answered on 09 Mar 2010
2 answers
134 views
Hi,

Is there a way I can edit the Filter name of a built-in column Filter option. So if I want to rename "NotIsEmpty" to "NotEmpty" can I do it without ofcourse changing the functionality? If yes how?

Thanks
Phani Musale
Top achievements
Rank 1
 answered on 09 Mar 2010
3 answers
148 views

Hey everyone,

I've got a Textbox being placed inside a RadTreeNode. It all works great, except I can't select any text, either by clicking and dragging, or by using shift and the arrow keys. Is there any easy way I can fix this?

Note: at first, hitting enter didn't work either, but then I found this post:

http://www.telerik.com/community/forums/aspnet-ajax/treeview/radtreeview-control-with-textbox-space-issue.aspx

edited the code a tiny bit, and that works fine now. I tried editing it a bit more to allow for shift-arrowing, but to no avail. 

Thank you,

Tommy Walsh

Tommy Walsh
Top achievements
Rank 1
 answered on 09 Mar 2010
1 answer
161 views
I have a custom field template for choosing / uploading images in my dynamic data project.

The uploading worked fine pretty much out of the box, but I just can't figure out how to get the progress manager / progress area to work. Basically need to provide users with feedback as their files are being uploaded in the DynamicData web application. My Edit page templaet is plain vanilla:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"> 
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true"> 
        <DataControls> 
            <asp:DataControlReference ControlID="FormView1" /> 
        </DataControls> 
    </asp:DynamicDataManager> 
    <h2 class="DDSubHeader"> 
        Edit 
        <%= table.DisplayName %> 
        record</h2> 
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
        <ContentTemplate> 
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true" 
                HeaderText="List of validation errors" /> 
            <asp:DynamicValidator runat="server" ID="DetailsViewValidator" ControlToValidate="FormView1" 
                Display="None" /> 
            <asp:FormView runat="server" ID="FormView1" DataSourceID="DetailsDataSource" DefaultMode="Edit" 
                OnItemCommand="FormView1_ItemCommand" OnItemUpdated="FormView1_ItemUpdated" OnDataBound="FormView1_DataBound"> 
                <HeaderTemplate> 
                    <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Update" Text="Update" 
                        CssClass="btnNext" /> 
                    <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Cancel" Text="Cancel" 
                        CausesValidation="false" CssClass="btnNext" /> 
                </HeaderTemplate> 
                <EditItemTemplate> 
                    <table id="detailsTable" class="tableHR" cellpadding="6"> 
                        <asp:DynamicEntity runat="server" Mode="Edit" /> 
                    </table> 
                </EditItemTemplate> 
                <FooterTemplate> 
                    <br /> 
                    <asp:LinkButton ID="LinkButton3" runat="server" CommandName="Update" Text="Update" 
                        CssClass="btnNext" /> 
                    <asp:LinkButton ID="LinkButton4" runat="server" CommandName="Cancel" Text="Cancel" 
                        CausesValidation="false" CssClass="btnNext" /> 
                </FooterTemplate> 
                <EmptyDataTemplate> 
                    <div class="DDNoItem"> 
                        No such item.</div> 
                </EmptyDataTemplate> 
            </asp:FormView> 
            <asp:EntityDataSource ID="DetailsDataSource" runat="server" EnableUpdate="true"> 
                <WhereParameters> 
                    <asp:DynamicQueryStringParameter /> 
                </WhereParameters> 
            </asp:EntityDataSource> 
        </ContentTemplate> 
    </asp:UpdatePanel> 
</asp:Content> 
 

my custom field template looks like this:

<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="ImageUpload_Edit.ascx.cs" 
    Inherits="myProject.Admin.ImageUpload_Edit" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<div class="ImagePicker"> 
    <asp:Panel ID="feedback" runat="server" Visible="false"> 
        <p id="feedbackP" runat="server"> 
        </p> 
    </asp:Panel> 
    <table> 
        <tr> 
            <td style="width: 10%;"> 
                Current Image 
            </td> 
            <td> 
                <asp:Image ID="img1" runat="server" Visible="true" ImageUrl='<%# GetImgUrl() %>' 
                    Width="100" Height="100" AlternateText="Selected Image" /> 
                <asp:TextBox ID="TextBox1" runat="server" Text='<%# FieldValueEditString %>' CssClass="DDTextBox"></asp:TextBox> 
                <asp:Button ID="btnClearImg" runat="server" Text="Clear Image" CssClass="btnStandard" 
                    OnClick="btnClearImg_Click" /> 
            </td> 
        </tr> 
        <tr> 
            <td> 
                Upload New Image 
            </td> 
            <td> 
                <telerik:RadUpload ID="RadUpload1" runat="server" AllowedFileExtensions=".jpg, .jpeg" 
                    ControlObjectsVisibility="None" EnableFileInputSkinning="false" RegisterWithScriptManager="true"> 
                </telerik:RadUpload> 
                <asp:Button ID="btnUpload" runat="server" Text="Upload File" CssClass="btnStandard" 
                    OnClick="btnUpload_Click" /> 
            </td> 
        </tr> 
        <tr> 
            <td> 
                Choose Existing Image 
            </td> 
            <td> 
                <asp:Button ID="btnChooseExisting" runat="server" Text="Choose Existing File" CssClass="btnStandard" 
                    OnClick="btnChooseExisting_Click" /> 
                <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="true" 
                    GridLines="None" PageSize="10" Skin="Office2007" AutoGenerateColumns="false" 
                    Visible="false" OnNeedDataSource="gridsNeedData"> 
                    <PagerStyle Mode="NumericPages" /> 
                    <MasterTableView NoMasterRecordsText="There are no records for you to view"> 
                        <Columns> 
                            <telerik:GridTemplateColumn ItemStyle-Width="100px"> 
                                <HeaderTemplate> 
                                    <asp:Button ID="btnCloseRadGrid1" runat="server" OnClick="btnCloseRadGrid1_Click" 
                                        Text="Close Image Picker" CssClass="btnStandard" /> 
                                </HeaderTemplate> 
                                <ItemTemplate> 
                                    <asp:Button ID="btnSelect" runat="server" OnClick="btnSelect_Click" Text="Select" 
                                        CssClass="btnStandard" /> 
                                    <%--                    <asp:Button ID="btnDelete" runat="server" OnClick="btnDelete_Click" Text="Delete" OnClientClick="return confirm('Are you sure you want to delete this item?\r\n\r\n(Cannot Undo)\r\n');" />--%> 
                                </ItemTemplate> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridImageColumn DataImageUrlFields="URL" ImageHeight="75" ImageWidth="75" 
                                HeaderText="Image (may appear distorted)" /> 
                            <telerik:GridBoundColumn DataField="FileName" HeaderText="Filename" /> 
                        </Columns> 
                        <AlternatingItemStyle CssClass="rgAltRow" /> 
                        <SortExpressions> 
                            <telerik:GridSortExpression FieldName="FileName" SortOrder="Ascending" /> 
                        </SortExpressions> 
                    </MasterTableView> 
                </telerik:RadGrid> 
            </td> 
        </tr> 
    </table> 
    <asp:RegularExpressionValidator runat="server" ID="RegularExpressionValidator1" CssClass="DDControl" 
        ControlToValidate="TextBox1" Display="Dynamic" Enabled="false" /> 
    <asp:DynamicValidator runat="server" ID="DynamicValidator1" CssClass="DDControl" 
        ControlToValidate="TextBox1" Display="Dynamic" /> 
</div> 
 

and the code behind on the field template is:

using System; 
using System.Collections.Specialized; 
using System.ComponentModel.DataAnnotations; 
using System.Web.DynamicData; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using Telerik.Web.UI; 
using System.Collections.Generic; 
 
namespace myProject.Admin 
{ 
    public partial class ImageUpload_Edit : System.Web.DynamicData.FieldTemplateUserControl 
    { 
        internal sealed class ImageDetails 
        { 
            public string FileName { get; set; } 
            public string URL { get; set; } 
        } 
 
        string _CurrentFileName { get; set; } 
        List<ImageDetails> _ExistingImgList { get; set; } 
 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            SetUpValidator(RegularExpressionValidator1); 
            SetUpValidator(DynamicValidator1); 
        } 
 
        protected Uri GetImgUrl() 
        { 
            try 
            { 
                Uri imgUri = new Uri(string.Format("{0}{1}", Constants._WEBIMAGELOCATION, this.FieldValue.ToString())); 
                return imgUri; 
            } 
            catch (Exception) 
            { 
                img1.Visible = false; 
                return null; 
            } 
        } 
 
        protected override void ExtractValues(IOrderedDictionary dictionary) 
        { 
            dictionary[Column.Name] = ConvertEditedValue(TextBox1.Text); 
        } 
 
        public override Control DataControl 
        { 
            get 
            { 
                return TextBox1; 
            } 
        } 
 
        protected void gridsNeedData(object sender, GridNeedDataSourceEventArgs e) 
        { 
            GetFileListData(); 
            RadGrid1.DataSource = _ExistingImgList; 
        } 
         
        protected void btnUpload_Click(object sender, System.EventArgs e) 
        { 
            //DisposeRadGrid1(); 
            bool transferSuccessful = false; 
 
            if (this.RadUpload1.InvalidFiles.Count > 0) 
            { 
                feedbackP.InnerHtml = "You cannot upload that type of file. Please submit documents as JPG images (.JPG, .JPEG)<br />" + 
                    "Please ensure that your uploaded files end with an appropriate file extension (noted above)<br />"; 
                feedback.CssClass = "emergency_box"; 
                feedback.Visible = true; 
            } 
            else 
            { 
                transferSuccessful = HandleUploadedFiles(); 
 
                if (transferSuccessful) 
                { 
                    feedbackP.InnerHtml = "Your file was uploaded successfully."; 
                    feedback.CssClass = "callout_box"; 
                    feedback.Visible = true; 
 
 
                    TextBox1.Text = _CurrentFileName; 
                    ShowImg1(); 
                } 
                else 
                { 
                    feedbackP.InnerHtml = "No File Selected or File upload failed."; 
                    feedback.CssClass = "callout_box"; 
                    feedback.Visible = true; 
                } 
 
 
            } 
        } 
 
        protected void GetFileListData() 
        { 
            List<string> myList = Helpers.callFtpDir(new ftpService.serviceArgs() { transferProfile = Constants._FTPTRANSFERPROFILEMYRECYCLOPEDIA }, Constants._REMOTEPATH); 
 
            _ExistingImgList = new List<ImageDetails>(); 
            myList.ForEach(i => _ExistingImgList.Add(new ImageDetails() { FileName = i, URL = string.Format("{0}{1}", Constants._WEBIMAGELOCATION, i) })); 
        } 
 
        protected void btnChooseExisting_Click(object sender, System.EventArgs e) 
        { 
            GetFileListData(); 
            RadGrid1.DataSource = _ExistingImgList; 
            RadGrid1.DataBind(); 
            RadGrid1.Visible = true; 
 
            btnChooseExisting.Visible = false; 
        } 
 
        protected void btnClearImg_Click(object sender, EventArgs e) 
        { 
            DisposeRadGrid1(); 
            img1.Visible = false; 
            TextBox1.Text = null; 
        } 
 
        protected void btnCloseRadGrid1_Click(object send, EventArgs e) 
        { 
            DisposeRadGrid1(); 
        } 
 
        protected void btnSelect_Click(object sender, System.EventArgs e) 
        { 
            _CurrentFileName = ((sender as Button).Parent.Parent as GridDataItem)["FileName"].Text; 
            TextBox1.Text = _CurrentFileName; 
            DisposeRadGrid1(); 
            ShowImg1(); 
        } 
        protected void btnDelete_Click(object sender, System.EventArgs e) 
        {  
            // not implemented as will require a yet-unwritten ftp call 
        } 
         
             
         
        private bool HandleUploadedFiles() 
        { 
            //System.Threading.Thread.Sleep(10000);// simulate long file load for testing 
 
            int failCount = 0; 
            bool blnResultsExist = false; 
            try 
            { 
                blnResultsExist = this.RadUpload1.UploadedFiles.Count > 0; 
                if (blnResultsExist) 
                { 
                    if (System.IO.Directory.Exists(Constants._ATTACHMENTPATH) == false) 
                    { 
                        try 
                        { 
                            System.IO.Directory.CreateDirectory(Constants._ATTACHMENTPATH); 
                        } 
                        catch (Exception ex) 
                        { 
                            feedbackP.InnerHtml = "Remote directory cannot be created. Error message is " + ex.ToString(); 
                            feedback.CssClass = "emergency_box"; 
                            feedback.Visible = true; 
 
                            string strMessage = ""; 
                            strMessage = ex.Message.ToString() + Constants._VBCRLF + Constants._VBCRLF + ex.StackTrace.ToString(); 
                        } 
                    } 
                } 
                if (RadUpload1.UploadedFiles.Count == 1) 
                { 
                    foreach (Telerik.Web.UI.UploadedFile file in RadUpload1.UploadedFiles) 
                    { 
                        file.SaveAs(string.Format("{0}\\{1}", Constants._ATTACHMENTPATH, file.FileName)); 
 
                        // build the arguments for the ftp service and execute it 
                        ftpService.serviceArgs args = Helpers.buildServiceArgsJobDescription(file); 
                        bool serviceResponse = Helpers.callFtpService(args); 
                        if (serviceResponse == false) 
                            failCount++; 
                    } 
                } 
            } 
            catch (Exception ex) 
            { 
                string strMessage = ""; 
                strMessage = ex.Message.ToString() + Constants._VBCRLF + Constants._VBCRLF + ex.StackTrace.ToString(); 
 
                feedbackP.InnerHtml = strMessage; 
                feedback.CssClass = "emergency_box"; 
                feedback.Visible = true; 
 
                failCount++; 
            } 
 
            if (failCount == 0 && blnResultsExist) 
                _CurrentFileName = RadUpload1.UploadedFiles[0].FileName; 
 
            return (failCount == 0 && blnResultsExist); 
        } 
 
        private void DisposeRadGrid1() 
        { 
            RadGrid1.DataSource = null; 
            RadGrid1.Visible = false; 
            btnChooseExisting.Visible = true; 
        } 
 
        private void ShowImg1() 
        { 
            img1.ImageUrl = string.Format("{0}{1}", Constants._WEBIMAGELOCATION, _CurrentFileName); 
            img1.Visible = true; 
        } 
 
    } 
} 
 

I tried replacing the asp:UpdatePanel with teh telerik one; just dropping in the RadProgressManager and RadProgressArea; using the postback trigger method per: http://www.telerik.com/help/aspnet-ajax/upload_uploadingajax.html
etc

Help Please!!

/jonathan
Genady Sergeev
Telerik team
 answered on 09 Mar 2010
1 answer
147 views
Hi, I am using upload and the gridbinary column pretty much right out of the samples found elsewhere on this site. I am not even bothering with upload progress bars, etc. and there is no ajax involved. I am using  Q3 2009, and the Uploaded file name is present, but the length is zero - I am trying to read into a byte array but there is nothing to read into. Here is a code frag - if anyone knows what I am doing wrong here, please  let me know.

Dim editItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
                    Dim upload As RadUpload = DirectCast(editItem.EditManager.GetColumnEditor("Upload"), GridBinaryImageColumnEditor).RadUploadControl
                    Dim MyUploadedFile As Telerik.Web.UI.UploadedFile = upload.UploadedFiles(0)

                    Dim MyFileName As String = MyUploadedFile.FileName ' this evaluates to the file I am uploading
                    Dim fs As System.IO.Stream = MyUploadedFile.InputStream ' fs.length is always zero.

                    Dim picture As Byte() = New Byte(fs.Length - 1) {}
                    fs.Read(picture, 0, fs.Length - 1)
                    fs.Close()

Genady Sergeev
Telerik team
 answered on 09 Mar 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?