Results 1 to 13 of 13

Thread: javascript.write('<textarea runat="server" id="txt"')

  1. #1

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    javascript.write('<textarea runat="server" id="txt"')

    how do i access a runt at server control witout putting a script block of server side code on the page to handle the event that needs the thing? it's an IFRAME/textarea richedit to generate html kept in the db. and while I am working on moving it to being a System.Web.UI.Control based web control..... I need this editor to work sooner then i'll finish that little project.
    Magiaus

    If I helped give me some points.

  2. #2

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    The problem being that the code won't compile to a dll but it should run from a page, and I can't help it that seems hacked to me. If it will even work from the page block.
    Magiaus

    If I helped give me some points.

  3. #3
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Anyway, What's your question? You can use the Javascript event model, and in the unlikely event JS isn't enabled, it will have to postback to the server.

    If you want an HTMLTextBox editor, there are some really cheap ones available on the Internet from 3rd party sources... probably would cost your company 5 times less, rather than paying you at your salary to do it.

  4. #4

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    I want access to the data in a control written from javascript so i can put in a db. is there a way i can do that without putting code on an aspx

    see i personal download those off people sites and look for secruity flows and i don't want to expose one
    Last edited by Magiaus; Apr 22nd, 2004 at 10:45 PM.
    Magiaus

    If I helped give me some points.

  5. #5
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    I want access to the data in a control written from javascript

    You want data from a Javascript control, to send to a database?

    Or you want to access the data in a .Net Server Control on the client side using Javascript(which would be stored in viewstate btw), and send that to a database using Javascript, so it doesn't have to post back to the server to upload data?

  6. #6

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    I have javascript that writes

    <textarea id=xxx runat=server>DATA</textarea>
    Magiaus

    If I helped give me some points.

  7. #7

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    I want asp.net to grab the data on postback and put it in the db. The question is. Does anyway know of a way to do this that will compile so that I will not have to place a block of runat server c# code on my aspx. if you don't understand i'm sorry i don't know how to say it any plainer
    Magiaus

    If I helped give me some points.

  8. #8
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    So...

    This data, how is it presented in the Javascript? I'm unclear if you're writing HTML markup, or you are just trying to postback the contents of a Javascript array variable.

    Could you get by generating a blank hidden field to the client, which gets populated by the Javascript before postback, and then the .Net framework would have access to the value of the control on postback.

    So, if you just delcare and render the empty HtmlHiddenField from C# code-behind (which gets compiled), and only evaluate its data on postback (again inside the C# code behind), you should be set.
    Last edited by nemaroller; Apr 24th, 2004 at 11:34 PM.

  9. #9

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    I'm making a composite server control to solve the problem because then I can get it working no problem. I was looking for a way to avoid rewriting alot of javascript into into a server control. To late.
    Magiaus

    If I helped give me some points.

  10. #10
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    You could just have the control add a link attribute to its containing page on the prerender, that points to an external Javascript file.

    But I would, if you have the time, simply incorporate it into the control, if for nothing else, the javascript will always be available to it, in case the external js file could not be loaded for any reason, or got corrupted.

  11. #11

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    Thats what I'm working on but I didn't write the orginal code and while it isn't super advanced it is on the weird side. It's about 2000 lines of js and it is currenlty geared wrong, so I am rewritting the js and converting it to a server control.

    IE4+/NN6 only frame[x].designMode = 'On' to turn an iframe into a lite html editor but you know I have to make every feature I want by reading/writing/parsing the body tag of the iframe and blah blah blah.

    At least I know an easy way to write/reg the script. Embed it in my asm as a .js and just read the text and...... a lot better then formatting a 2000 line js with StringBuilder. Can you say error on line 1075, where the hell is that. On the bright side I looked at buying this last night and it's worth $200 bucks
    Last edited by Magiaus; Apr 25th, 2004 at 01:46 PM.
    Magiaus

    If I helped give me some points.

  12. #12

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    @#$%^% after 4 hrs I finaly got the design mode to enable for my iframe. It wouldn't enable because the iframe had no src.
    Magiaus

    If I helped give me some points.

  13. #13
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    a lot better then formatting a 2000 line js with StringBuilder. Can you say error on line 1075, where the hell is that.

    Lol... yea, I don't even bother to format the JS within stringbuilder. Just cram it all together after you made sure it works using an external file.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width