Home

Util.RawHtml and input box

With Util.RawHtml I can create an HTML input box in the result window. Is it possible to retrieve the contents of this input field in my c# code?

Comments

  • edited September 2015
    I'm also interested in this. Also consider retrieving user input from other control types: select, checkbox, radio, textarea...
  • edited April 29

    Super late to respond, but after some Googling, I just completed this in LINQPad 8 as below:

    void Main()
    {
        var input = Util.RawHtml("<textarea id='links' rows='10' style='width: 100%;'></textarea>").Dump(); 
        var btn = new Button("Create Google Search Links", c => CreateLinks(input)).Dump(); // Ignore the button text, I am trying to create links from texts.
    }
    
    static void CreateLinks(object input)
    {
        var t = (string)Util.InvokeScript(true, "eval", "document.getElementById('links').value");
        t.Dump("TextArea string");
    }
    

    Thanks.

  • Am I missing something?
    What's wrong with just using the standard LinqPad Textarea control?

Sign In or Register to comment.