c# - set asp.net session variable from an html input element? -
i have form asp.net control button has postbackurl. setting session variable via postback (to same page) dropdownlist , retrieve session variable when page redirected postbackurl when clicking button.
problem is, need add search feature page also. cannot use asp.net textbox control because of design issues in clients page.
is possible use html input element , capture typed value, , store in asp.net session variable on button click can retrieve in page?
i using code in page_load of code-behind, of page has search box (first page)
postbackoptions postbackoptions = new postbackoptions(searchbutton); postbackoptions.actionurl = "/searchdesc"; searchbutton.attributes.add("onclick", page.clientscript.getpostbackeventreference(postbackoptions)); is possible store session variable in that? have tried using ajax doesnt redirect on click.
any help?
you can create html input , add attribute of runat="server" , set id member, can attach event handler if wish , catch whatever value need in code behind.
html example:
<input type="text" id="yourcustominput" runat="server" onclick="yourcustommethod" /> code behind:
protected void yourcustommethod(object sender, eventargs e) { //your custom code }
Comments
Post a Comment