Re: setting a form control from javascript
From: Greg Burns (greg_burns_at_DONT_SPAM_ME_hotmail.com)
Date: 07/24/04
- Next message: dawood: "Re: pdf conversion using c# and asp.net"
- Previous message: Shan Plourde: "Re: Error reading special character '{' hexadecimal value 0x7B in xml"
- In reply to: Andy Fish: "setting a form control from javascript"
- Next in thread: Andy Fish: "Re: setting a form control from javascript"
- Reply: Andy Fish: "Re: setting a form control from javascript"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 24 Jul 2004 10:18:14 -0400
Can't you just add a runat=server and an id to the HTML control?
<input type="hidden" runat="server" id="id1">
OR generate it at run-time using a PlaceHolder:
<asp:PlaceHolder ID="ph" Runat="server" />
Dim myInputHidden As New HtmlControls.HtmlInputHidden
ph.Controls.Add(myInputHidden)
Not sure what you gain by using the placeholder method though. Escepcially
because the ClientID would not be known at design time for use with your js
code.
Greg
"Andy Fish" <ajfish@blueyonder.co.uk> wrote in message
news:eNEJkiVcEHA.2324@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I want to generate a value with javascript and include it in the form
> postback for a web form.
>
> based on my previous web development experience, I think I need an <input
> type=hidden> on the page. However, to fit in properly with the web forms
> paradigm, I would like this to be a proper asp.net server side control
> rather than just generating it in the HTML.
>
> I have found I can do this OK with a text box as long as it's visible; if
I
> make the text box hidden it is no longer rendered in the HTML (and so i
> can't set it from javascript). What's the best way to achieve what I'm
> trying to do?
>
> Andy
>
>
- Next message: dawood: "Re: pdf conversion using c# and asp.net"
- Previous message: Shan Plourde: "Re: Error reading special character '{' hexadecimal value 0x7B in xml"
- In reply to: Andy Fish: "setting a form control from javascript"
- Next in thread: Andy Fish: "Re: setting a form control from javascript"
- Reply: Andy Fish: "Re: setting a form control from javascript"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|