I have a bar chart with multiple series.
chartResults.DataManager.ValuesYColumns = "fValue"
chartResults.DataManager.ValuesXColumn = "iDate"
chartResults.DataGroupColumn = "sType"
chartResults.PlotArea.XAxis.Appearance.ValueFormat = Styles.ChartValueFormat.ShortDate
chartResults.DataSource = dt
chartResults.DataBind()
chartResults.PlotArea.XAxis.AutoScale = True
chartResults.PlotArea.XAxis.IsZeroBased = False
chartResults.PlotArea.YAxis.IsZeroBased = True
chartResults.PlotArea.XAxis.Appearance.Visible = Styles.ChartAxisVisibility.True
When one series exists, the rightmost point lies to the right (correctly) of XLabel 10/23/2012. When a second series is added, the rightmost point moves to the left of 10/23/2012. This is incorrect, and does not reflect the accuracy of the first series.
Can someone offer any advice, or workaround to get the points to stay on their correct x-axis point?
Any help or advice is greatly appreciated! TIA!
<asp:Panel ID="pnlFileUpload" runat="server">
Allowed File Extensions are: .jpg, .gif, .bmp, .png
<telerik:RadUpload id="RadUpload1" Runat="server" AllowedFileExtensions="jpg, gif, bmp, png" TargetFolder="~\Portals\0\ClientLogos" MaxFileInputsCount="1" >
</telerik:RadUpload>
<asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" />
</asp:Panel>
When a user clicks on the "Save" button, I want to write a message that says "Saved at [current time]" (like Gmail does when saving a draft). In order to get the current time I was going to use javascript. How do I go about calling the Javascript to get the time and displaying it in my label?
Some things to note:
Any help would be appreciated.
| Server Error in Application. |
| Could not find a part of the path 'F:\Applications\Upload\Hours\test.txt'. |
| Exception Details: System.IO.DirectoryNotFoundException: ... |
<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 SystemImports System.DataImports System.DrawingImports System.Drawing.Drawing2DImports System.Drawing.ImagingImports System.IOImports Telerik.Web.UIImports AFOHAB_DAL.AFOHABTableAdaptersPublic 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 FunctionEnd Classprotected 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)); } } }