Click here to Skip to main content
15,917,709 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Aes Encryption fails Pin
Richard Deeming11-Feb-14 8:27
mveRichard Deeming11-Feb-14 8:27 
GeneralRe: Aes Encryption fails Pin
vishalgpt11-Feb-14 16:21
vishalgpt11-Feb-14 16:21 
GeneralRe: Aes Encryption fails Pin
Richard Deeming12-Feb-14 1:26
mveRichard Deeming12-Feb-14 1:26 
GeneralRe: Aes Encryption fails Pin
vishalgpt24-Feb-14 4:01
vishalgpt24-Feb-14 4:01 
Questionabout source code Pin
punith Kumar Raj10-Feb-14 23:59
punith Kumar Raj10-Feb-14 23:59 
AnswerRe: about source code Pin
Peter Leow11-Feb-14 0:17
professionalPeter Leow11-Feb-14 0:17 
QuestionRe: about source code Pin
punith Kumar Raj14-Feb-14 18:09
punith Kumar Raj14-Feb-14 18:09 
Questionhow to add data in listbox sql server using store procedure Pin
bindash10-Feb-14 21:41
bindash10-Feb-14 21:41 
QuestionRe: how to add data in listbox sql server using store procedure Pin
thatraja10-Feb-14 22:25
professionalthatraja10-Feb-14 22:25 
QuestionHow to call a Phython Script from .Net Pin
Kandepu Rajesh10-Feb-14 21:03
Kandepu Rajesh10-Feb-14 21:03 
AnswerRe: How to call a Phython Script from .Net Pin
Kornfeld Eliyahu Peter10-Feb-14 23:24
professionalKornfeld Eliyahu Peter10-Feb-14 23:24 
Questionon hover on menu items Pin
Shashi Ranjan10-Feb-14 19:42
Shashi Ranjan10-Feb-14 19:42 
QuestionUpload file to SQL database using html5 Pin
Member 1057920210-Feb-14 7:49
Member 1057920210-Feb-14 7:49 
AnswerRe: Upload file to SQL database using html5 Pin
Richard Deeming10-Feb-14 8:11
mveRichard Deeming10-Feb-14 8:11 
GeneralRe: Upload file to SQL database using html5 Pin
Member 1057920210-Feb-14 11:39
Member 1057920210-Feb-14 11:39 
GeneralRe: Upload file to SQL database using html5 Pin
Richard Deeming11-Feb-14 1:03
mveRichard Deeming11-Feb-14 1:03 
GeneralRe: Upload file to SQL database using html5 Pin
Member 1057920212-Feb-14 11:57
Member 1057920212-Feb-14 11:57 
Thanks Richard! I figured it out!

for those curious, here is code that uses html5, jquery, javascript, and an asp.net handler to display selected image, upload image from client and save to SQL Server...

here is html..
<input type="file" id="upldFile" name="files[]" />

<input type="button" value="Add Sign" data-icon="plus" data-mini="true" id="btnAddSign">


here is javascript...
JavaScript
$('#upldFile').change(function (evt) {
    var formData = new FormData();
    var files = evt.target.files;
    for (var i = 0, f; file = files[i]; i++) {
        if (!file.type.match('image.*')) {
              continue;
       }
       var thumbnail = URL.createObjectURL(file);
       formData.append(file.name, file);
       $('body').data('formdata', formData);
       var span = document.createElement('span');
       span.innerHTML = ['<img class="thumb" src="', thumbnail,
       '" title="', escape(file.name), '"/>'].join('');
       document.getElementById('list').insertBefore(span, null);
       }
});


JavaScript
$('#btnAddSign').click(function () {
     var xhr = new XMLHttpRequest();
     var url = 'Handler1.ashx?requestid=' + $('body').data('requestid') + '&backcolor=' + $('#cmbBackColor').val() + '&textcolor=' + $('#cmbTextColor').val() + '&signshape=' + $('#cmbSignShape').val() + '&signsize=' + $('#cmbSignShape').val() + '&platematerial=' + $('#cmbPlateMaterial').val() + '&border=' + $('#sldBorder').val() + '&signtext=' + $('#txtSignText').val() + '&signquantity=' + $('#txtSignQuantity').val()
     xhr.open('POST', url, true);
     xhr.onload = function (e) {
     };
     xhr.onreadystatechange = function () {
     if (xhr.readyState == 4 && xhr.status == 200) {
              GetItems(); //function that loads jqwidgets grid 
     }
     }
     xhr.send($('body').data('formdata'));
  });


Here is handler.ashx
HTML
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
       Dim requestid As String = context.Request.QueryString("requestid").ToString
       Dim backcolor As String = context.Request.QueryString("backcolor").ToString
       Dim textcolor As String = context.Request.QueryString("textcolor").ToString
       Dim signshape As String = context.Request.QueryString("signshape").ToString
       Dim signsize As String = context.Request.QueryString("signsize").ToString
       Dim platematerial As String = context.Request.QueryString("platematerial").ToString
       Dim signtext As String = context.Request.QueryString("signtext").ToString
       Dim signquantity As String = context.Request.QueryString("signquantity").ToString
       Dim border As Boolean = context.Request.QueryString("border").ToString
       Dim Files As HttpFileCollection
       Files = context.Request.Files
       Dim uploadFiles As HttpFileCollection = Files
       For i = 0 To uploadFiles.Count - 1
           Dim postedFile As HttpPostedFile = uploadFiles(i)
           Dim inStream As System.IO.Stream = postedFile.InputStream
           Dim fileData As Byte() = New Byte(postedFile.ContentLength - 1) {}
           inStream.Read(fileData, 0, postedFile.ContentLength)
           Dim cnInsert As New SqlConnection(GetConnectionString("MyConnectionString"))
           Dim cmdInsert As New SqlCommand
           Dim da As New SqlDataAdapter
           Dim lastupdate As New DataTable
           Dim ds As New DataSet()
           cnInsert.Open()
           cmdInsert.Connection = cnInsert
           cmdInsert.CommandType = CommandType.StoredProcedure
           cmdInsert.CommandText = "spSRQSignsCustomInsert"
           cmdInsert.Parameters.AddWithValue("@pSignSize", signsize)
           cmdInsert.Parameters.AddWithValue("@pSignBackColor", backcolor)
           cmdInsert.Parameters.AddWithValue("@pSignShape", signshape)
           cmdInsert.Parameters.AddWithValue("@pSignText", signtext)
           cmdInsert.Parameters.AddWithValue("@pSignQuantity", signquantity)
           cmdInsert.Parameters.AddWithValue("@pSignTextColor", textcolor)
           cmdInsert.Parameters.AddWithValue("@pBorder", border)
           cmdInsert.Parameters.AddWithValue("@pPlateMaterial", platematerial)
           cmdInsert.Parameters.AddWithValue("@pRequestID", requestid)
           cmdInsert.Parameters.AddWithValue("@pRequestedImage", fileData)
           cmdInsert.ExecuteNonQuery()
           cnInsert.Close()
       Next
   End Sub

Questionweb api - global.aspx error - does not contain a constructor that takes 0 arguments Pin
miss78610-Feb-14 3:22
miss78610-Feb-14 3:22 
AnswerRe: web api - global.aspx error - does not contain a constructor that takes 0 arguments Pin
Richard Deeming10-Feb-14 4:42
mveRichard Deeming10-Feb-14 4:42 
GeneralRe: web api - global.aspx error - does not contain a constructor that takes 0 arguments Pin
miss78611-Feb-14 5:57
miss78611-Feb-14 5:57 
Questiona prefix of _ctl0_ to an asp.net link button Pin
Member 1058475710-Feb-14 0:25
Member 1058475710-Feb-14 0:25 
AnswerRe: a prefix of _ctl0_ to an asp.net link button Pin
Deflinek10-Feb-14 2:24
Deflinek10-Feb-14 2:24 
AnswerRe: a prefix of _ctl0_ to an asp.net link button Pin
Richard Deeming10-Feb-14 3:07
mveRichard Deeming10-Feb-14 3:07 
GeneralRe: a prefix of _ctl0_ to an asp.net link button Pin
Member 1058475710-Feb-14 4:46
Member 1058475710-Feb-14 4:46 
GeneralRe: a prefix of _ctl0_ to an asp.net link button Pin
Richard Deeming10-Feb-14 4:52
mveRichard Deeming10-Feb-14 4:52 

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.