Click here to Skip to main content
15,887,881 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: IE version problem Pin
Nathan Minier20-Jun-16 1:27
professionalNathan Minier20-Jun-16 1:27 
GeneralRe: IE version problem Pin
parthi_src21-Jun-16 7:05
parthi_src21-Jun-16 7:05 
AnswerRe: IE version problem Pin
John C Rayan20-Jun-16 1:48
professionalJohn C Rayan20-Jun-16 1:48 
GeneralRe: IE version problem Pin
parthi_src21-Jun-16 7:06
parthi_src21-Jun-16 7:06 
GeneralRe: IE version problem Pin
John C Rayan22-Jun-16 1:33
professionalJohn C Rayan22-Jun-16 1:33 
GeneralRe: IE version problem Pin
parthi_src22-Jun-16 7:00
parthi_src22-Jun-16 7:00 
GeneralRe: IE version problem Pin
John C Rayan23-Jun-16 4:00
professionalJohn C Rayan23-Jun-16 4:00 
QuestionHow to trigger an event from fileupload? Pin
turbosupramk316-Jun-16 6:25
turbosupramk316-Jun-16 6:25 
I'm new to ASP, but not c#.

The fileupload control seems to be different than the rest of my controls, I cannot seem to link it to my c# code.

Do I need to create an event listener for it? Or a background worker process thread to monitor something from it?

I'm sure this is caused by me not understanding how the html and c# code work. How can I communicate between the fileupload control and my c sharp code in the background? I tried to put a javascript function into the head portion but it does not appear to be called and when I put a break point in there to test it, it does not hit the break point.

Thanks



ASP.NET
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="True"
    CodeBehind="Default.aspx.cs" Inherits="exchangePictureUpdater.exchangePictureUpdater" %>


<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

<script src="jquery-2.2.4.js"></script>
      <script>

          function loadimage() {
              alert($("#thefile").prop('files'));
          }

          function readURL(input) {
              if (input.files && input.files[0]) {
                  var reader = new FileReader();

                  reader.onload = function (e) {
                      $('#imgBox')
                          .attr('src', e.target.result)
                      <%--.width(150)
                          .height(200); --%>
                      $("#<%=tbxPictureHeight.ClientID %>").val("");
                      $("#<%=tbxPictureWidth.ClientID %>").val("");
                      $("#<%=tbxPictureFileSize.ClientID %>").val("");

                      $('#imgBox').on('load', function () {
                          var height = this.naturalHeight,
                              width = this.naturalWidth;
                          $("#<%=tbxPictureHeight.ClientID %>").val(height);
                          $("#<%=tbxPictureWidth.ClientID %>").val(width);
                          var imgpath = document.getElementById('theFile');
                          //if (!imgpath.value==""){
                          //var img=imgpath.files[0].size;
                          //var imgsize=img/1024; 
                          //alert(imgsize);
                          //$("#<%=tbxPictureFileSize.ClientID %>").val(imgsize);
                      });
                  };

                  reader.readAsDataURL(input.files[0]);

              }
          }
          //function btnAddReplace_Click() {
          //    alert($("#imgBox").prop('src'));
          //}

      </script>

</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:Button ID="btnResolvePin" runat="server" Height="29px" Text="Resolve Pin" Width="160px" OnClick="btnResolvePin_Click" />
&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="tbxPinName" runat="server"></asp:TextBox>
&nbsp;&nbsp;&nbsp;
    &nbsp;&nbsp;&nbsp;
    
    <asp:DropDownList ID="ddlDomains" runat="server">
        <asp:ListItem Value="1"></asp:ListItem>
        <asp:ListItem Value="2"></asp:ListItem>
        <asp:ListItem Value="3"></asp:ListItem>
        <asp:ListItem Value="4"></asp:ListItem>
        <asp:ListItem Value="5"></asp:ListItem>
        <asp:ListItem Value="6"></asp:ListItem>
        <asp:ListItem Value="7"></asp:ListItem>
        <asp:ListItem Value="8"></asp:ListItem>
    </asp:DropDownList>
    <br />
&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="lblUserResolvedName" runat="server" Text="User Resolved Name"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="tbxUserName" runat="server" ReadOnly="True" Width="354px"></asp:TextBox>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="btnTest" runat="server" Height="29px" OnClick="btnTest_Click" Text="Test" />
    <br />
    <br />
&nbsp;<asp:Label ID="lblBrowseForPicture" runat="server" Text="Browse For Picture"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="lblPictureHeight" runat="server" Text="Picture Height"></asp:Label>
&nbsp;
    <asp:Label ID="lblPictureWidth" runat="server" Text="Picture Width"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Label ID="lblPictureFileSize" runat="server" Text="File Size"></asp:Label>
    <br />
    <asp:FileUpload ID="thefile" runat="server" onchange="readURL(this);" itemid="thefile" value="thefile" Width="347px" />
&nbsp;&nbsp;&nbsp;&nbsp;<asp:TextBox ID="tbxPictureHeight" runat="server" ReadOnly="True" Width="70px"></asp:TextBox>
&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="tbxPictureWidth" runat="server" ReadOnly="True" Width="70px"></asp:TextBox>
&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="tbxPictureFileSize" runat="server" ReadOnly="True" Width="70px"></asp:TextBox>
    <asp:Label ID="lblPictureFileSizeInKBs" runat="server" Text="KB's"></asp:Label>
&nbsp;&nbsp;&nbsp;
    <br />
    <br />
    <asp:Button ID="btnViewPicture" runat="server" Height="29px" OnClick="btnViewPicture_Click" Text="View Picture" Width="160px" />
    <br />
    <br />
    <asp:Button ID="aspbtnAddReplace" runat="server" Height="29px" OnClick="btnAddReplace_Click" text="Add/Replace Picture" Width="160px" />
    <br />
    <br />
    <asp:Button ID="btnDelete" runat="server" Height="29px" OnClick="btnDelete_Click" Text="Delete Picture" Width="160px" />
    <br />
    <br />
    <asp:Button ID="btnSavePicture" runat="server" Height="29px" OnClick="btnSavePicture_Click" Text="Save Picture" Width="160px" />
    <br />
    <br />
    <asp:Button ID="btnClearPicture" runat="server" Height="29px" OnClick="btnClearPicture_Click" Text="Clear Picture" Width="160px" />
    <br />
    <br />
    <asp:Image ID="imgBox" runat="server" ImageUrl='<%# "data:image/jpg;base64," + Convert.ToBase64String((byte[])Eval("IMG_DATA")) %>' />
&nbsp; 
    <asp:Panel ID="DialogControl" Visible="false" runat="server" style="position:absolute;width:200px;height:150px;top:200px;right:300px;border:thick;z-index:100" BackColor="Red" BorderColor="Black" BorderStyle="Solid" BorderWidth="5px">
        <asp:Literal ID="DialogContent" runat="server"></asp:Literal><br />
        <asp:Panel id="buttonpanel" runat="server" style="text-align: center; position:relative;" Height="100%" Width="100%" BackColor="Red" >
        <asp:Button ID="DialogOKButton" runat="server" Text="OK" OnClick="DialogOKButton_Click" style="text-align: center; position: absolute; bottom:0;"/>

        </asp:Panel>
    </asp:Panel>
</asp:Content>

AnswerRe: How to trigger an event from fileupload? Pin
jkirkerx16-Jun-16 8:02
professionaljkirkerx16-Jun-16 8:02 
AnswerRe: How to trigger an event from fileupload? Pin
F-ES Sitecore17-Jun-16 1:49
professionalF-ES Sitecore17-Jun-16 1:49 
QuestionReg Chorome Browser Pin
harikreddy16-Jun-16 2:29
harikreddy16-Jun-16 2:29 
AnswerRe: Reg Chorome Browser Pin
Nathan Minier17-Jun-16 1:47
professionalNathan Minier17-Jun-16 1:47 
AnswerRe: Reg Chorome Browser Pin
F-ES Sitecore17-Jun-16 1:51
professionalF-ES Sitecore17-Jun-16 1:51 
AnswerRe: Reg Chorome Browser Pin
John C Rayan20-Jun-16 1:53
professionalJohn C Rayan20-Jun-16 1:53 
Questionhow to get latitude and logitude from sql server Asp.net WEBForm Pin
Member 1180506316-Jun-16 1:03
Member 1180506316-Jun-16 1:03 
AnswerRe: how to get latitude and logitude from sql server Asp.net WEBForm Pin
Member 1180506317-Jun-16 1:56
Member 1180506317-Jun-16 1:56 
QuestionBad Behavior Pin
BobbyStrain15-Jun-16 9:35
BobbyStrain15-Jun-16 9:35 
AnswerRe: Bad Behavior Pin
jkirkerx15-Jun-16 10:18
professionaljkirkerx15-Jun-16 10:18 
GeneralRe: Bad Behavior Pin
BobbyStrain15-Jun-16 12:44
BobbyStrain15-Jun-16 12:44 
GeneralRe: Bad Behavior Pin
Nathan Minier16-Jun-16 1:18
professionalNathan Minier16-Jun-16 1:18 
GeneralRe: Bad Behavior Pin
BobbyStrain16-Jun-16 6:24
BobbyStrain16-Jun-16 6:24 
GeneralRe: Bad Behavior Pin
Nathan Minier17-Jun-16 1:57
professionalNathan Minier17-Jun-16 1:57 
GeneralRe: Bad Behavior Pin
BobbyStrain17-Jun-16 5:50
BobbyStrain17-Jun-16 5:50 
Question@Url is saying "the name url doesn't exist in the current context" ASP.MVC 4 Pin
indian14314-Jun-16 10:02
indian14314-Jun-16 10:02 
AnswerRe: @Url is saying "the name url doesn't exist in the current context" ASP.MVC 4 Pin
jkirkerx15-Jun-16 7:24
professionaljkirkerx15-Jun-16 7:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.