0
<canvas id="colors_sketch"  width="500" height="200">
   <asp:Button id="submit_button" Text="Submit" CssClass="btn btn-success" runat="server" OnClick="getValue"/>

 protected void getValue(object sender, EventArgs e)
 {
    var base64 = colors_sketch.ToString;   
 }

I want to convert the user drawing to base64, when I add run = server in colors_sketch, I fail to do the drawing. Any ideas how to do this?
I want save the base64 into database when user clicks Submit.

croxy
  • 4,082
  • 9
  • 28
  • 46
KyLim
  • 468
  • 1
  • 6
  • 22
  • canvas is a client side thing. asp.net and c# run on the server. you have to use javascript – Daniel A. White Nov 14 '16 at 02:37
  • Possible duplicate of: [Capture HTML Canvas as gif/jpg/png/pdf?](http://stackoverflow.com/questions/923885/capture-html-canvas-as-gif-jpg-png-pdf) – Abion47 Nov 14 '16 at 02:40
  • @Abion47 how can document.getElementById function in c# ? :D – KyLim Nov 14 '16 at 02:44
  • @KyLim Like Daniel said, the canvas is client side and your C# is server side. You need to convert the canvas to an image using Javascript and then send it to your server. – Abion47 Nov 14 '16 at 02:48

0 Answers0