|
I have a datalist with a few events and an event handler in my Code-Behind file.
I need to send post data to a server and open the page.
Say for example when you create a simple html along with all value/pairs.
How can I get this same action from within a datalist control?
I'm thinking I might need to use WebClient class but I'm to new at this to no the easiest way.
Thanx,
Nick
=============================
What was I gonna say...
|
|
|
|
|
|
Well, I'm not to sure. Let me explain alittle of what I want to accomplish. I have bound a product id to my dataList :: DataKeyField="ItemNumber".
So when a user clicks on my LinkButton, I use the product key from DataKeyField and use this to extract details from my database for preparing my post.
I'm trying to post to Paypal IPN... I dont want to use GET because this allows altering of price which is no good.
I think I might be able to use WebClient() for this but am not sure how to go about this.
============================================
I picked up this code and converted it to C#, but does not seem to work for me:
Dim xmlhttp As Object
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
' Indicate that page that will receive the request and the
' type of request being submitted
xmlhttp.Open "POST", "http://localserver/test.asp", False
' Indicate that the body of the request contains form data
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
' Send the data as name/value pairs
xmlhttp.send "Id=1&S=2"
Set xmlhttp = Nothing
=========================================================
http://www.developerfusion.com/show/3272/2/
I need to figure this out soon...
=============================
What was I gonna say...
|
|
|
|
|
The WebClient won't help you. It's a client class that sends requests to the server and downloads responses.
All server-side events for controls are done through HTTP post. If you actually look at the HTML that is generated and download to the client (the browser, presumably), clicking on a DataList with post-back enabled calls __doPostBack (as does everything else) with certain parameters. Certain hidden fields and any other fields are submitted via theForm.submit() (theForm is the ID of the sole ASP.NET form, unless you change the ID yourself - which you can do).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I wish I could say I knew what you're talking about ...
I am still new in ASP.NET / C# :: Can you dumb this up a bit?
=============================
What was I gonna say...
|
|
|
|
|
Hi, how i search for repeated items in a DataTable?
Example:
I have the Column Name and Email.
I want to delete every Name and Email repeateds.
Thanks.
|
|
|
|
|
|
See the DataTable.Select command. It uses the same expressions as DataColumn.Expression . You could use this to get a DataRow[] array and then remove each of those array members from the DataTable .
Another way would be to sort the DataTable and iterate - not enumerate, which is what foreach does - through it keeping track of the last DataRow and comparing it with the current DataRow . If they contain the same data, remove the current DataRow (which is why you don't enumerate - changing a collection that you're enumerating throws an exception). Don't forget to decrement your index for the for loop since it will be incremented with the next iteration (you want to keep the index the same since you just removed a DataRow ).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am working in a C# program that creates an Excel application.
To allow C# use the functionality of Excel, I generated the next:
tlbimp Excel9.olb Excel.dll
From Visual Studio, now I can browse all the objects associated with this library. But sometimes, I work with a simple editor on another little computer which does not have IDE.
My question is: How Can I print o save all the object information about Excell.dll for using as a reference in my programming task? Or ... is there any site where I can see all the documentation related to Excel objects library?
Very best regards!!
|
|
|
|
|
Just make sure you move that Excel.dll assembly around with you, especially when you deploy your solution (the interop assembly you compiled against must be included or your application won't work).
How do you remember what there is in the assembly? Simple, look at the object model for Excel on http://msdn.microsoft.com[^]. A COM interop assembly uses a typelib to generate the interop assembly. VB uses a typelib for class and member discovery and compilation. There is no difference.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello all,
I nee to encrypt numbers, the encrypted data and the public data must be in digits only.
Any ideas hot to do it simply?
|
|
|
|
|
Anything you encrypt is only digits: 0 and 1. If you need an encoding that uses ASCII characters 0-9, you probably won't find a standard one because it's inefficient.
One idea is to encrypt the data using the System.Security.Crytography namespace members (see the .NET Framework SDK for more information). That will encrypt your data to a byte[] array. you could encode that array as the numeric value of each byte delimited by some character like a space, comma, or period so that you can decode the byte[] array to decrypt. Unless you use a mechanism where every number fills a certain number of bytes or spaces (fixed-width encoding), you'll need a delimiter.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Here's one simple question. How do you quantify on cost of context switches? And how can you decide whether or not a method should be executed synchronously or asychronously?
I hestitate on logging the time at which the thread is launched and the time the first line the thread func is run... Perhaps I should take average of these time logs to decide if the function really should be executed synch or async...
Anyway, for ASP.NET application... Here's a reference
Norman Fung
|
|
|
|
|
It's not always a question of time - but when it is, only you can answer that question because only you know your requirements and only you know what's acceptable. It's like a doctor asking a patient about their pain on a scale from 1 to 10. There's no standard. Only you can answer it.
When it's not about time, it's about execution. If need to download a file but want the user to be able to continue using your application, then you should download the file asynchronously. If you need to display a dialog while this is happening, that should be displayed in the UI threa while the download occurs in a background thread. It's those types of requirements that also drive whether or not you should use synchronous or asynchronous calls.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks. My concern is that I've synchronous access to locked resources (cached user credentials, access tokens, and a bunch of other security related information). And that automatically implies some limitation on scalability. But, how can one tell if launching more threads (in which case penalty is context switches) is more/less efficient than executing synchronous (in which case penalty is concurrent access to locked resources).
Norman Fung
|
|
|
|
|
|
How can I determine if an audio CD or DVD is inserted? I already used the sample of detecting a disk being inserted/removed fron CP, but I need to determine i it's a movie or audio disk.
I have been searching on Google and Yahoo all morning with no real sucess. Any help would be appreciated.
Regards
Eric C. Tomlinson
No comment, Mr. Senator<pre>
|
|
|
|
|
Detect what files are on the disk. If it's an Audio CD, Windows displays the CD data as .wav files (IIRC, it's been a long time since I actually looked - just try it). A movie CD (by which I assume you mean either a VCD or DVD) also contains certain file types.
This is actually what Windows Explorer for XP does when you insert CDs. Sometimes it's quick because certain types of files can be detected quickly. Other types, you actually see it searching the disk's content. That's how it determines what items to display in the new Auto Run dialog for Windows XP.
Note that Windows Explorer interprets data on an Audio CD differently than other platforms might. The CD is not really comprised of WAV files, but WAV data. It's up to the Window manager or other application to interpret that data and display it as files if so desired. It actually has more to do with file systems than anything.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
So basically read the drive to determine/set the type of disk. I suspected this but was hoping you could query the system about it after insertion of the disk. I'm going to override the autoplay for certain types of files. Thanks again Heath for the short sweet answer and the good point in the correct direction.
Regards
Eric C. Tomlinson
No comment, Mr. Senator<pre>
|
|
|
|
|
In new projects i have been used C#, but my boss ask me Why C# ?
If the FrameWork is the same, why i used the C# ?
" I used because this language is better than VB.NET in OOP."
Is this correct? I don´t remember where i read this information.
Are there any Documents , Articles .... about : VB.NET x C# ?
Wich language is the best ?
thanks for help
|
|
|
|
|
You deleted your post from Lounge withing few minutes and posted it here. Smart move.
You can find your answer in C# Frequently Asked Questions blog[^] by c# team.
//Start of joke
Never comment ur code. If it was hard to write, it should be hard to understand !!!
//End of joke
|
|
|
|
|
Sorry, the Lounge is not for coding questions.
Thanks for help
|
|
|
|
|
Search the comments. Recently there was a discussion about that issue.
|
|
|
|
|
Like Stefan said, there was a similar discussion about 2 weeks back[^]
Luis Ricardo wrote:
In new projects i have been used C#, but my boss ask me Why C# ?
What would indicate to your boss that you should pick something else. If you know C# better than VB.NET then why not?
Luis Ricardo wrote:
" I used because this language is better than VB.NET in OOP."
Well, they have similar features, just a different syntax. C# does take more advantage of features of the CLR so it is probably just ahead.
Luis Ricardo wrote:
Wich language is the best ?
That question is very loaded, there are two camps and people on each will defend their position as to why their choice is better. However, IMO, it is all really what you know best.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
|
|
|
|
|
Thanks. I will read the similar discussion.
|
|
|
|