c# - How to set Textbox's Text as an querystring argument for LinkButton without having codebhind file? -
i having user control file without codebehind file in dotnentnuke.
in have put form in have 1 textbox , 1 linkbutton.
i want pass textbox's value when press button querystring access in page.
for have written following code not work.
<asp:textbox id="txtemail" runat="server" class="txtbox" placeholder="enter email here"></asp:textbox> <asp:linkbutton id="linkbutton1" class="lbsubscrb" runat="server" postbackurl="~/portals/_default/skins/gravity/dummy.aspx?add=<% txtemail.text %>" forecolor="white">subscribe</asp:linkbutton>
all answers appreciated...
it sounds need own custom module, instead of trying take existing module, without source code, , make different?
that being said, if want take existing module , make that, jquery going method of choice.
basically wan hijack click event button , send elsewhere, along lines of following code. wrote of last night module working on (newsletter subscriptions, way) have removed of logic make simpler trying do
edit: replaced txtbox class below match textbox's class
<script language="javascript" type="text/javascript"> /*globals jquery, window, sys */ (function ($, sys) { $(document).ready(function () { var originalhref = $('.lbsubscrb a').attr('href'); $('.lbsubscrb a').removeattr("href"); $('.txtbox').focus(function () { if($('.txtbox').val().indexof('@')<1) $('.txtbox').val(''); }); $('.txtbox').bind("keypress", function (e) { if (e.keycode == 13) { $('.lbsubscrb a').click(); } }); $('.lbsubscrb a').click(function () { //check if hit enter in textbox , submit form if (validateemail($('.txtbox').val())) { // //todo: add jquery redirect call here. // //uncomment line use original submit functionality //eval(originalhref.replace('javascript:', '')); //if postback wanted uncomment next line //$('.lbsubscrb a').removeattr("href"); } else { alert('something wrong email'); } }); }); }(jquery, window.sys)); function validateemail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/; return re.test(email); } </script>
Comments
Post a Comment