15,891,567 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by bobishkindaguy (Top 18 by date)
bobishkindaguy
7-Jul-17 12:44pm
View
I got it working, much appreciated. There were a couple of more things that had to be done so I thought I'd update this with that.
1. I had to add this, as you suggested. It needed to go in the site.master:
"multipart/form-data"
2. I added runat="server" to the "Uploader"markup -- which as you said made it into a "HtmlControls.HtmlGenericControl" in the default.aspx designer code file.
3. Then I had to add the following to the default.aspx markup file. (includes code for providing debug feedback)
<%@ Implements Interface="System.Web.UI.ICallbackEventHandler" %>
Dim _cbMessage As String = ""
'Method that processes the callbacks on server.
Public Sub RaiseCallbackEvent(ByVal eventArgument As String) _
Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent
Try
Page.ClientScript.ValidateEvent(Uploader1.UniqueID, Me.ToString())
_cbMessage = "Correct event raised callback."
Catch ex As Exception
_cbMessage = "Incorrect event raised callback."
End Try
End Sub
'Method that returns callback result.
Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult
Return _cbMessage
End Function
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If (Not IsPostBack) Then
Dim CM As ClientScriptManager = Page.ClientScript
Dim CallBackRef As String = CM.GetCallbackEventReference("'" & Page.UniqueID & "'", "arg", "ReceiveServerData", "", "ProcessCallBackError", False)
Dim CallbackScript As String = "function CallTheServer(arg, context) {" & CallBackRef & "; }"
CM.RegisterClientScriptBlock(Me.GetType(), "CallTheServer", CallbackScript, True)
End If
End Sub
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Page.ClientScript.RegisterForEventValidation(Uploader1.UniqueID, Me.ToString())
MyBase.Render(writer)
End Sub
var value1 = new Date();
function ReceiveServerData(arg, context)
{
Message.innerText = arg;
Label1.innerText = "Callback completed at " + value1;
value1 = new Date();
}
function ProcessCallBackError(arg, context)
{
Message.innerText = 'An error has occurred.';
}
bobishkindaguy
6-Jul-17 18:43pm
View
Okay, I'll get to work on that. Thanks for your patience !
bobishkindaguy
6-Jul-17 18:41pm
View
Deleted
I have been trying to use the one that has this code to save the filename in a label:
onchange... (codeproject deleted the code)
Of course, that saves the name in the label text, but it's not clear to me where the file content goes.
bobishkindaguy
6-Jul-17 18:32pm
View
I agree that the FileUpload control would be the easiest thing to use, but the reason I arrived at this page is for the same reason as the OP. I need to "put some style" on the FileUpload control.
Therefore the stackoverflow page you suggested is great and works fine, but since it doesn't use the FileUpload control, I'm not sure where the file contents are when the postback occurs. The Request.Files has zero files in it.
bobishkindaguy
6-Jul-17 17:48pm
View
I'm new to asp.net. So I need just a bit more help.
I got it browsing fine, and then it displays the filename - nice for the user to confirm that's the one they want to process.
So then I put a "Submit" button on the page, and the user clicks that which gets me to the code behind.
You're saying the submitted page has the actual file "embedded" in it, and all I have to do is get that using HttpPostedFile and save it on the server side, right?
I don't see "Page.HttpPostedFile" or "Session.HttpPostedFile", would you mind posting a code snippet to show how to get the file contents into a variable? My files will be text, so I would probably be carefully converting the object to a string.
I've looked at HttpPostedFile Class in msdn, but there is no code example.
bobishkindaguy
6-Jul-17 17:07pm
View
The stackoverflow reference above has everything to style the controls and browse for the file, but I can't see how to get the resulting path into asp.net so I can upload the file.
bobishkindaguy
10-Nov-15 8:37am
View
Thanks KR, I see what you mean. In fact, your solution would work in VB or C#.
What I need is to understand the syntax C# uses, new { @class = "xxx" } and how VB does this. It's not just Razor but Lambda that I struggle with here. Your thoughts?
bobishkindaguy
10-Nov-15 8:33am
View
Thanks, I should have mentioned that none of the converters seem to work on this correctly. I've spent several hours already on this before asking the question here. It's not for lack of effort; rather I am new to Razor.
I think it's the part: new { @class = "col-md-2 control-label" } that is not converting. The converter gives me:
New With { .[class] "col-md-2 control-label" }
(Note the square brackets around "class", which is an improvement over what I mentioned above as a possible translation.)
But even though this might look right, I then get the error I mentioned (which I think is not the real problem):
"Late binding operations cannot be converted to an expression tree".
The red wiggly line is under m.FromName.
bobishkindaguy
13-May-13 16:40pm
View
Thanks Jegan, I will give your suggestion a try.
bobishkindaguy
19-Feb-13 21:42pm
View
Thanks Zoltán!
I located some base64 encoder code, (http://www.codeproject.com/Articles/5483/Base64-Encoder-Decoder-in-C), and converted it to VB. So far I can save the html doc in a database field and retrieve it, whereupon it appears as an image, so I think with a few more tweaks I'll be fine. Next task will be attachments, same goal.
bobishkindaguy
19-Feb-13 21:40pm
View
Thanks Marcus, your suggestion goes to a page that works, but with a tool.
I found Zoltán's reference, located some base64 encoder code, (http://www.codeproject.com/Articles/5483/Base64-Encoder-Decoder-in-C), and converted it to VB. So far I can save the html doc in a database field and retrieve it, whereupon it appears as an image, so I think with a few more tweaks I'll be fine. Next task will be attachments, same goal.
bobishkindaguy
19-Feb-13 19:02pm
View
The document will be saved in a database, so it must be free of any file references.
bobishkindaguy
7-Nov-12 12:56pm
View
Thanks for your suggestions, Maciej.
I know how to do wizard windows, but my post was intended to demonstrate that the AutoScroll property doesn't work properly, unless I am missing something.
Content scrolls out of view all the time, both to the left or right. In the window you are now viewing, content is scrolled up out of sight, and you can use the scroll bar to bring it back. The AutoScroll property should work similarly to manage content horizontally.
bobishkindaguy
6-Nov-12 18:24pm
View
The textbox could be a panel or any other control. I probably should have used a panel. This is for a wizard window. Usually the user clicks "Back" or "Next" to make the screens of the wizard come into view.
I wanted to allow the user to scroll a row of panels left and right, so they had a choice of using the scroll bar or the Back and Next buttons.
If you use the button to make the textbox go out of sight to the right, the scroll bar appears. But if you use the button to make the textbox go out of sight to the left, the scrollbar does not appear. I believe it should, though.
bobishkindaguy
5-Nov-12 9:44am
View
Oh, my instructions for creating this project didn't include the following:
Please open the designer code window and delete the auto-generated code from that window before running the project.
You will see the problem then.
bobishkindaguy
5-Apr-12 14:09pm
View
Pablo, you are a genius. You pegged my app exactly. Even as I was writing my original question, your suggestion occurred to me as well, but you know, when you're on a path that you have invested in, you are reluctant to abandon it. You think, "but it could still be useful as the app evolves, so I'm not ready to give up on it yet". I develop alone, so occasionally it is good to have peer opinion, and I thank you very much for providing that. Of course, your suggestion is the right path, and I will now implement that. I'm sure that "simplification" will result.
bobishkindaguy
5-Apr-12 6:17am
View
Excellent idea, accumulate data as often as it changes, but only allow the data to be displayed when the timer fires 2 or 3 times per second.
But the question still remains... my import classes are raising "report progress" events - they are handled by the BackgroundWorker (or rather, the import classes are issuing the bw.ReportProgress command, which in turn appears in the UI thread as an event "ProgressChanged"), but what happens if the UI thread has started the process? Where do those events get handled then?
bobishkindaguy
4-Aug-11 2:27am
View
@SAKryukov: I have created a client/server system where there is one server and many clients, on many computers. Each client needs the server program to be running. So instead of "worrying" that the server program might not have been started, or telling the user to "go over and start the server program", I am thinking of ways to ensure that 1. it is either very likely to have been started, by making a service run it upon boot, and 2. the service can respond to a request from client (using .Net Remoting) and start the server program. I have been looking at XYNTService now. I might be able to modify that to include the .NET Remoting functionality.
Show More