jQWidgets Forums

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts

  • humpagm
    Participant

    Hi JOlmos,

    I was also having a similar problem getting the code-behind for VB.NET. What I used was a generic handler to do the post back to the server. Here is my code:

    <%@ WebHandler Language=”VB” Class=”AjaxFileUploaderHandler” %>

    Imports System
    Imports System.Web
    Imports System.Collections.Generic
    Imports System.Linq
    Imports System.IO
    Imports System.Web.Configuration
    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Object
    Imports System.Windows.Input.Cursor

    Public Class AjaxFileUploaderHandler : Implements IHttpHandler

    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
    ‘// VB code automatically entered when class was created
    ‘context.Response.ContentType = “text/plain”
    ‘context.Response.Write(“Hello World”)

    Dim ws As New WebService
    Dim File As HttpPostedFile = Nothing
    Dim sType As String = “”
    Dim bSuccess As Boolean = False

    Try

    If context.Request.Files.Count > 0 Then

    File = context.Request.Files(0)
    ws = New WebService

    bSuccess = ws.SaveAttachment(File)

    End If

    Catch ex As Exception

    Finally
    If Not IsNothing(ws) Then ws.Dispose()
    ws = Nothing
    File = Nothing
    End Try
    End Sub

    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
    Get
    Return True
    End Get
    End Property

    End Class

    This does work for me, but I am having an issue where when I click on the browse button, the control does a post back. I’m not entirely sure what the problem is, but I thought I’d share what I did and hope that it helps.

Viewing 1 post (of 1 total)