-1

I have been trying to find a way or code that will convert c# data to html code/html template by a ButtonClick but have just found some converters that convert C# code to HTML code and thats not what i need. Its by a ButtonClick that i need C# data that is filled in by users in the program this data is texts and images. Cant provide any code cause i only got the front end UI designed nothing else and i got to low reputation to upload a pic =)

P.S i am a noob at C# done some things in C# in the past but have forgot alot when i havent been working with it for years.

  • Please don't recreate the same question twice in a row without any useful information. Instead of adding whole bunch "I'm new/know nothing/searched a lot" it would be better to explain what you actually try to do. I suspect you want Winform app to submit data to a web page via POST request... – Alexei Levenkov Jul 31 '13 at 00:41
  • send me the photo and I can post it for you – jth41 Jul 31 '13 at 00:42
  • yeah, kind of Alexei okey then i will provide false info next time to sound smart and well researched.... – user2632342 Jul 31 '13 at 07:30
  • yeah its something in that direction you know anything about it alexei ? – user2632342 Jul 31 '13 at 07:30

1 Answers1

0

I have a hunch that you are attempting to submit data from your server side to a client side web page via POST. If this is the case, the stages would be as follows:

  1. The web page will send a request to the server. You might want to use a full postback or an ajax call. If you are a newbie, the full postback would be easier for you.
  2. The Server side will fetch required data (the C# data).
  3. The server will wrap up the C# data to a structure that can be parsed by the client side.
  4. The server will send the wrapped up data back to the client.

Details:

The part you asking about is #3 (wrapping up the data to a structure that can be parsed by the client side ).
In order to do so I suggest using a JavaScriptSerializer as described in this SO thread (including code example...).

In case your data is an object that has many redundant properties that are not required by the client side, I would also consider using anonymous types for sending only required data. You can find an example for how to do this here

Community
  • 1
  • 1
Avi Turner
  • 10,234
  • 7
  • 48
  • 75