Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
2.0K+ views
I have developped some aspx page with a RadUpload Control.
After setting everything on my dev server, it worked fine
but when uploading it on the prod server, I received the following message after clicking the "Submit" button;

Server Error in Application.     
Could not find a part of the path 'F:\Applications\Upload\Hours\test.txt'.     
Exception Details: System.IO.DirectoryNotFoundException: ... 

My question is; what are the access right requirements for RadUpload to work?
As in an intranet environment, we setted up a generic account for this IIS application with Full rights on this folder but I suspect maybe something with the rights, any hint?

Regards,
David
Waseem
Top achievements
Rank 1
 answered on 24 Nov 2012
8 answers
168 views
Ok,

Been playing with Telerik for a little while, really like it, thinking about purchase but I hit a wall.

I have a content page that has NO update panels just the rad controls and a couple of datalists to display the results...works on my machine and on the server but on the server when we upload a large amount of files it uploads just fine BUT the progress control never finishes on the users screen but the upload does work...I cannot replicate on my dev machine so i cant figure the problem...The control works perfectly on two or three files and its not specific on how many files it takes to fail...

Does this set of controls have issues on GoDaddy?

Code Below,

Thanks!
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div style="width:1200px;margin:0 auto;">
         
        <h1>Upload Listing Images</h1>
        <asp:HyperLink ID="hypReturn" runat="server">Return to Edit Listing Page</asp:HyperLink>
        <br /><br />
 
        <div style="float:left;width:500px;margin:0 50px 0 50px;">
            <telerik:RadProgressManager id="rdProgress1" runat="server" />
 
            <telerik:RadProgressArea ID="pgBar1" runat="server" Language="" />
            <telerik:RadUpload ID="upPics" runat="server" OverwriteExistingFiles="false"
                 AllowedFileExtensions=".jpg,.jpeg,.gif,.jpe" MaxFileSize="5242880" InitialFileInputsCount="5" />
            <br />
            <asp:Button ID="buttonSubmit" runat="server" Text="Upload All" CssClass="RadUploadSubmit"    />
        </div>
 
        <div style="float:left;width:500px;font-size:12px;">
            <asp:Label ID="lblNoResults" runat="server" Visible="true">No Uploaded Files Yet.</asp:Label>
            <asp:Repeater ID="repResults" runat="server" Visible="false">
                <HeaderTemplate>
                    <div>Uploaded Files</div>
                </HeaderTemplate>
                <ItemTemplate>
                    <%#DataBinder.Eval(Container.DataItem, "Filename")%>
                    (<%#DataBinder.Eval(Container.DataItem, "ContentLength").ToString & " bytes"%>)
                    <br />
                </ItemTemplate>
            </asp:Repeater>
            <br />
            <asp:Repeater ID="repInvalidResults" runat="server" Visible="false">
                <HeaderTemplate>
                    <div>Invalid Files</div>
                </HeaderTemplate>
                <ItemTemplate>
                    File: <%#DataBinder.Eval(Container.DataItem, "Filename")%>
                    (<%#DataBinder.Eval(Container.DataItem, "ContentLength").ToString() + " bytes"%>)
                    <br />
                    Mime-type: <%#DataBinder.Eval(Container.DataItem, "ContentType").ToString()%>
                    <br /><br />
                </ItemTemplate>
            </asp:Repeater>
        </div>      
     
     
    </div>   
 
    <div style="clear:both;"></div>
     
</asp:Content>


Imports System
Imports System.Data
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.IO
Imports Telerik.Web.UI
Imports AFOHAB_DAL.AFOHABTableAdapters
 
Public Class upimage
    Inherits System.Web.UI.Page
 
#Region "Globals"
    'destination
    Dim dest As String = Server.MapPath("~/listimgs/")
    Dim ListID As String
#End Region
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'get listing id otherwise redirect
        ListID = Request.QueryString("ListingID")
 
        If ListID Is Nothing Or ListID = "" Then
            'no data
            Response.Redirect("~/admin/admin.aspx")
        Else
            'continue
 
            'assign return navigate url
            hypReturn.NavigateUrl = "~/admin/listingedit.aspx?id=" & ListID
        End If
    End Sub
 
    Private Sub buttonSubmit_Click(sender As Object, e As System.EventArgs) Handles buttonSubmit.Click
 
        dest = dest & ListID & "\" 'create sub dir based on ListingID
        Dim tbAdp As New tblListing_ImagesTableAdapter 'declare tableadapter to us Images Table
 
        'for each file we will upload and count
        'Dim upf As UploadedFileCollection = upPics.UploadedFiles
 
        If upPics.UploadedFiles.Count > 0 Then
            For Each validfile As UploadedFile In upPics.UploadedFiles
 
                'create directory
                If Not Directory.Exists(dest) Then
                    Directory.CreateDirectory(dest)
                End If
 
                'upfile
                Dim upfile As String = ListID & "-" & validfile.GetName
 
                If File.Exists(dest & upfile) Then
                    'not sure?? threw new exception in old code
                End If
 
                'lower characters
                upfile = upfile.ToLower
 
                ''we need to remove spaces, and other odd characters from file names!!!
                Dim Util As New Utility
                upfile = Util.StripNonAlphaNumericCharacters(upfile)
 
                'reduce length
                If upfile.Length > 40 Then
                    Dim ext As String = upfile.Substring(upfile.LastIndexOf(".") + 1, 3).ToUpper
                    upfile = upfile.Substring(0, 40)
                    upfile = upfile & "." & ext
                End If
 
                'savefile
                validfile.SaveAs(dest & upfile)
 
                'create DB record - if there are no other records for this listing use as main!
                If tbAdp.CountListingImages(ListID) = 0 Then
                    tbAdp.Insert(System.Guid.NewGuid, ListID, "listimgs/" & ListID & "/" & upfile, validfile.GetExtension, True)
                Else
                    tbAdp.Insert(System.Guid.NewGuid, ListID, "listimgs/" & ListID & "/" & upfile, validfile.GetExtension, False)
                End If
 
                '7/2012 - new resize by set image size
                'resize
                'now we need to open the image and resize if nec
                'Dim flOrig As New FileInfo(dest & upfile)
                'Dim flSize As Integer = flOrig.Length / 1024
                Dim flO As String = dest & upfile
                Dim flOt As String = dest & "tmp" & upfile
                'flUpload.Dispose()
 
                'If flSize > 100 Then
                'greater than 100KB then resize
                Dim imgPhoto As Image = ScaleImage(Image.FromFile(flO), 640) 'set width to 560
 
                Dim fExt As String = validfile.GetExtension
                If validfile.GetExtension.ToUpper = ".JPG" Or validfile.GetExtension.ToUpper = ".JPEG" Then
                    imgPhoto.Save(flOt, Imaging.ImageFormat.Jpeg)
                ElseIf validfile.GetExtension.ToUpper = ".GIF" Then
                    imgPhoto.Save(flOt, Imaging.ImageFormat.Gif)
                End If
 
                'imgPhoto.Save(flOt, Imaging.ImageFormat.Jpeg)
                imgPhoto.Dispose()
 
                'overwrite original and delete the temp
                File.Copy(flOt, flO, True)
                File.Delete(flOt)
                'End If
 
            Next
            lblNoResults.Visible = False
            repResults.Visible = True
            repResults.DataSource = upPics.UploadedFiles
            repResults.DataBind()
        Else
            lblNoResults.Visible = True
            repResults.Visible = False
        End If
 
        If upPics.InvalidFiles.Count > 0 Then
            repInvalidResults.Visible = True
            repInvalidResults.DataSource = upPics.InvalidFiles
            repInvalidResults.DataBind()
        End If
    End Sub
 
    Private Shared Function ScaleByPercent(ByVal imgPhoto As Image, ByVal Percent As Integer) As Image
        Dim nPercent As Single = (CSng(Percent) / 100)
 
        Dim sourceWidth As Integer = imgPhoto.Width
        Dim sourceHeight As Integer = imgPhoto.Height
        Dim sourceX As Integer = 0
        Dim sourceY As Integer = 0
 
        Dim destX As Integer = 0
        Dim destY As Integer = 0
        Dim destWidth As Integer = CInt((sourceWidth * nPercent))
        Dim destHeight As Integer = CInt((sourceHeight * nPercent))
 
        Dim bmPhoto As New Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb)
        bmPhoto.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution)
 
        Dim grPhoto As Graphics = Graphics.FromImage(bmPhoto)
        grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic
 
        grPhoto.DrawImage(imgPhoto, New Rectangle(destX, destY, destWidth, destHeight), New Rectangle(sourceX, sourceY, sourceWidth, sourceHeight), GraphicsUnit.Pixel)
 
        grPhoto.Dispose()
        imgPhoto.Dispose()
        Return bmPhoto
    End Function
 
    Private Shared Function ScaleImage(imgPhoto As Image, intNewWidth As Integer) As Image
 
        Dim sourceWidth As Integer = imgPhoto.Width
        Dim sourceHeight As Integer = imgPhoto.Height
        Dim sourceX As Integer = 0
        Dim sourceY As Integer = 0
 
        Dim newHeightPercent As Decimal = intNewWidth / sourceWidth
 
        If newHeightPercent > 1 Then
            'the image is already too small so jsut return the original image
            Return imgPhoto
        Else
            'the image IS too big so resize
            Dim destX As Integer = 0
            Dim destY As Integer = 0
            Dim destWidth As Integer = intNewWidth
            Dim destHeight As Integer = newHeightPercent * sourceHeight
 
            Dim bmPhoto As New Bitmap(destWidth, destHeight, PixelFormat.Format24bppRgb)
            bmPhoto.SetResolution(imgPhoto.HorizontalResolution, imgPhoto.VerticalResolution)
 
            Dim grPhoto As Graphics = Graphics.FromImage(bmPhoto)
            grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic
 
            grPhoto.DrawImage(imgPhoto, New Rectangle(destX, destY, destWidth, destHeight), New Rectangle(sourceX, sourceY, sourceWidth, sourceHeight), GraphicsUnit.Pixel)
 
            grPhoto.Dispose()
            imgPhoto.Dispose()
            Return bmPhoto
        End If
    End Function
 
End Class
Waseem
Top achievements
Rank 1
 answered on 24 Nov 2012
12 answers
167 views
hi,

I have a radUpload control named "radUp".

When I click on the submit button I call "uploadFile" :
"renameFile" is the new name written by the user on a textbox.
I want to save the file with this name, but I have 2 files on my Directory "Documents" after click: the renamed file and the other .... I want only the renamed file ... what's wrong?

protected void uploadFile()
        {
            if (radUp.UploadedFiles.Count > 0)
            {
                foreach (UploadedFile file in radUp.UploadedFiles)
                {
                    String targetFolder = Server.MapPath("~/Documents");
                    file.SaveAs(Path.Combine(targetFolder, renameFile.Text));
                }
            }
        }

Thanks
Waseem
Top achievements
Rank 1
 answered on 24 Nov 2012
0 answers
51 views
hey guys,

   I want to apply filtering inside radgrid using combobox but i always find only demo with sqldatasource
which i don't want I want filtering without using sqldatasource


any one can have solution?
Coolbudy
Top achievements
Rank 1
 asked on 24 Nov 2012
2 answers
195 views

Hi,
   I have used TextBox in my project.
This is my coding
 <asp:TextBox Width="95%" ID="Email" AutoCompleteType="Disabled" runat="server" CssClass="Lowercase1" Text='<%# Bind("emailid") %>'  MaxLength="50" onkeydown = "return (event.keyCode!=13);"></asp:TextBox>

Text box validate in Email

<telerik:RadInputManager ID="RadInputManager1" runat="server" EnableEmbeddedSkins="false">
 <telerik:RegExpTextBoxSetting ValidationExpression="^[\w\.\-]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]{1,})*(\.[a-zA-Z]{2,3}){1,2}$"
   ErrorMessage="Invalid Email" EnabledCssClass="Lowercase1" DisabledCssClass="Lowercase1">
    <TargetControls>
      <telerik:TargetInput ControlID="Email" />
    </TargetControls>
  </telerik:RegExpTextBoxSetting>
</telerik:RadInputManager>

this coding is working perfectly but AutoCompleteType="Disabled" is not working

same as Web address validation

<telerik:RegExpTextBoxSetting ValidationExpression="www.([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"
  ErrorMessage="Invalid Web Address" EnabledCssClass="Lowercase1" DisabledCssClass="Lowercase1">
   <TargetControls>
      <telerik:TargetInput ControlID="WebAddress" />
    </TargetControls>
 </telerik:RegExpTextBoxSetting>

Plz reply soon

Thanks,
Ansari


Tamim
Top achievements
Rank 1
 answered on 24 Nov 2012
1 answer
146 views
I have a formview inside my radwindow.  If close button is clicked inside a formview I want the window to close.
I tried to call javascript to close window, event is fired, but it does not close the window.
**********  Javascript ************

 function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.radWindow;
                else if (window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow;
                return oWindow;
            }

            function Close() {
                var arg = new Object();
                var oWnd = GetRadWindow();
                oWnd.close(arg);  
            }

********** Button to close the radwindow inside formview **************
      <asp:LinkButton ID="lnkBtnClose" runat="server" CausesValidation="False" CommandName="Close"                                    Text="Close" ToolTip="Close"  OnClientClick="Close(); return false;" />
Kevin
Top achievements
Rank 2
 answered on 23 Nov 2012
2 answers
237 views
Hello,

When I try to use raddatepicker.selecteddate  for a datetime var I get this error:

Cannot implicitly convert type 'object' to 'System.DateTime'. An explicit conversion exists (are you missing a cast?)
 
Here is my code:

    public partial class RegistroFalla
    {
        public int ID_Falla { get; set; }
        public Nullable<int> Duracion_Falla { get; set; }
        public System.DateTime Fecha { get; set; }
        public System.DateTime Hora_Deteccion { get; set; }
        public System.DateTime Hora_Diagnostico { get; set; }
        public System.DateTime Hora_Ocurrencia { get; set; }
        public System.DateTime Hora_Recuperacion { get; set; }
        public System.DateTime Hora_Solucion { get; set; }
        public string Descripcion { get; set; }
        public System.DateTime Tiempo_Deteccion { get; set; }
        public System.DateTime Tiempo_Recuperacion { get; set; }
        public System.DateTime Tiempo_Reparacion { get; set; }
        public System.DateTime Tiempo_Respuesta { get; set; }
        public string Division { get; set; }
    }

   var Fallo = new RegistroFallas.Model.RegistroFalla
                {
                    Hora_Ocurrencia = dpOcurrencia.SelectedDate,
                    Fecha = rdpFecha.SelectedDate,
                    Descripcion = txtDescripcion.Text,
                    Hora_Deteccion = rdpDeteccion.SelectedDate,
                    Hora_Diagnostico = rdpDiagnostico.SelectedDate,
                    Hora_Solucion = rdpSolucion.SelectedDate,
                    Hora_Recuperacion = rdpRecuperacion.SelectedDate
                };


Thanks,

Jorge
Jorge
Top achievements
Rank 1
 answered on 23 Nov 2012
2 answers
96 views
The code that I'm managing used an older version of the Telerik assemblies. We recently upgraded the assemblies to the most recent version. Upon upgrading said files, I received complaints that the paging was no longer showing on a grid. This is weird, since "Allow Paging" is set to True in the markup. I did some playing around and noticed if I removed the GroupByExpressions from the grid, the paging works fine. The GroupByExpressions seems to work fine either way, but is preventing the paging from working. Could someone possibly shine some light on the situation? I've included the grid's code below. Note: Ignore the empty strings; I removed some of the values for security reasons.

<telerik:RadGrid ID="RgStatusGrid" runat="server" AllowPaging="True" GridLines="None"
    AllowSorting="true" PageSize="50" OnNeedDataSource="RgStatusGrid_NeedDataSource"
    OnItemDataBound="OnItemDataBound" OnSortCommand="RgStatusGrid_SortCommand">
    <MasterTableView AutoGenerateColumns="false">
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectRegions>
                    <telerik:GridGroupByRegion RegionName="StateName" HeaderText="State" SortOrder="Ascending" />
                    <telerik:GridGroupByRegion RegionName="CityName" HeaderText="City" SortOrder="Ascending" />
                </SelectRegions>
                <GroupByRegions>
                    <telerik:GridGroupByRegion RegionName="StateName" HeaderText="State" SortOrder="Ascending" />
                    <telerik:GridGroupByRegion RegionName="CityName" HeaderText="City" SortOrder="Ascending" />
                </GroupByRegions>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <RowIndicatorColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridBoundColumn UniqueName="StateName" DataRegion="StateName" HeaderText="State" Visible="false" />
            <telerik:GridBoundColumn UniqueName="CityName" DataRegion="CityName" HeaderText="City" Visible="false" />
            <telerik:GridBoundColumn DataRegion="RegionName" HeaderText="Region" />
            <telerik:GridBoundColumn DataRegion="Area" HeaderText="Area (acres)" DataFormatString="{0:F2}" />
            <telerik:GridBoundColumn DataRegion="" HeaderText=""
                DataFormatString="{0:MM/dd/yyyy}" />
            <telerik:GridBoundColumn DataRegion="" HeaderText=""
                DataFormatString="{0:MM/dd/yyyy}" />
            <telerik:GridBoundColumn DataRegion="" HeaderText=""
                DataFormatString="{0:MM/dd/yyyy}" />
            <telerik:GridBoundColumn DataRegion="" HeaderText=""
                DataFormatString="{0:MM/dd/yyyy}" />
            <telerik:GridBoundColumn DataRegion="" HeaderText="" DataFormatString="{0:MM/dd/yyyy}" />
            <telerik:GridBoundColumn DataRegion="" HeaderText="" />
            <telerik:GridBoundColumn DataRegion="" HeaderText="" DataFormatString="{0:MM/dd/yyyy}" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
Brandon
Top achievements
Rank 1
 answered on 23 Nov 2012
3 answers
320 views
I was able to accomplish session expiration using the notification control set up for my web application thanks to this demo:

http://demos.telerik.com/aspnet-ajax/notification/examples/sessiontimeout/sessionexpired.aspx

However, this approach is based on a set timeout value and the notification just pops up every timed interval, regardless if the user is active or not. Can the session timeout be set/reset dynamically based on user inactivity? Possibly every time there is an Ajax request call? Some sample codes would be much appreciated. Thanks.
SDI
Top achievements
Rank 1
 answered on 23 Nov 2012
6 answers
92 views

Greetings,

I am new to Telerik (pretty new to asp.net) and cannot figure out why my AXAX CascadingDropDown events do not fire when I wire them up to control my RadAjaxLoadingPanel. The LoadingPanel updates but no SelectedIndexChanged event is call.

My code works when I disable/remove theRadAjaxLoadingPanel
 
I looked all over for the CascadingDropDown example but no success. I saw that I might need to rebind, but I'm not sure what I'm looking for to do this? Thanks

ASPX Page

<form id="frm1" runat="server" class="" enableviewstate="true">
 
<telerik:RadScriptManager runat="server" ID="RadScriptManager1">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1"
        EnablePageHeadUpdate="False" ViewStateMode="Enabled">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="auto_ddlMake">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="auto_ddlModel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="lnkReset" EventName="Click">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
<asp:DropDownList ID="auto_ddlMake" runat="server" AutoPostBack="True" class="itext"
                        OnSelectedIndexChanged="auto_ddlMake_SelectedIndexChanged" Width="125px" />
                    <ajaxToolkit:CascadingDropDown ID="CascadingDropDown1" runat="server" Category="Make"
                        ParentControlID="auto_ddlYear" PromptText="-- Pick --" ServiceMethod="GetMakes"
                        ServicePath="CascadingDropDown.asmx" TargetControlID="auto_ddlMake" />
 
<asp:DropDownList ID="auto_ddlModel" runat="server" AutoPostBack="True" class="itext"
                        OnSelectedIndexChanged="auto_ddlModel_SelectedIndexChanged" Width="125px" />
                    <ajaxToolkit:CascadingDropDown ID="CascadingDropDown2" runat="server" Category="Model"
                        ParentControlID="auto_ddlMake" PromptText="-- Pick --" ServiceMethod="GetModels"
                        ServicePath="CascadingDropDown.asmx" TargetControlID="auto_ddlModel" />
<asp:LinkButton ID="lnkReset" runat="server" CausesValidation="False" OnClick="btnReset_Click"
                        Text="Reset" ToolTip="Clear all fields"></asp:LinkButton>
 
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" ViewStateMode="Enabled">
        <div class="loading">
            Loading<br />
            <asp:Image ID="Image1" runat="server" ImageUrl="~/images/loading1.gif" AlternateText="loading">
            </asp:Image>
        </div>
    </telerik:RadAjaxLoadingPanel>
</form>

Codebehind

protected void auto_ddlModel_SelectedIndexChanged(object sender, System.EventArgs e)
    {
        Response.Write("ddlmodel Called!");
        Response.End();
    }

 

Pavlina
Telerik team
 answered on 23 Nov 2012
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?