c# - How do I add this (recaptcha) form dynamically? -
i have .aspx file , want dynamically add form , controls below in <script>
tag. (page-language=c#)
<form runat="server"> <asp:label visible=true id="lblresult" runat="server" /> <recaptcha:recaptchacontrol id="recaptcha" runat="server" theme="red" publickey="6ld4pcqsaaaaadvexkhlgujfxixyyej0x6zqdzan" privatekey="6ld4pcqsaaaaabag0i2nk6fmjbstxqqcs2xrdoea" /> <br /> <asp:button id="btnsubmit" runat="server" text="submit" onclick="btnsubmit_click" /> </form>
why want add dynamically? although, not answer question more simpler way put said markup in placeholder control , sets placeholder's visibility per requirements.
and if must add controls dynamically, still need placeholder (after script tag) parent , can create need control hierarchy code-behind. example,
var form = new htmlform(); var label = new label(); label.id = "lblresult"; form.controls.add(label); var captcha = new recaptchacontrol(); captcha.id = "recaptcha"; ... placeholder.controls.add(form);
Comments
Post a Comment