Request.form doesn't return a value with Visual Studio 2013 in code behind -
i think i'm getting blind....! what's wrong following code? visual studio 2013 "searchbox" doesn't return value vs 2008 works well.
code behind
partial class _default inherits page protected sub button1_click(byval sender object, byval e system.eventargs) handles button1.click response.write(request.form("searchbox")) end sub
end class
html page
<%@ page validaterequest="false" title="home page" language="vb" masterpagefile="~/site.master" autoeventwireup="true" codefile="default.aspx.vb" inherits="_default" %> <asp:content id="bodycontent" contentplaceholderid="maincontent" runat="server"> <asp:textbox id="searchbox" runat="server"></asp:textbox> <asp:button id="button1" runat="server" text="search" /> </asp:content>
it can't works vs2008 either. server control, actual client id of control won't searchbox
concatenation of parents ids of control. ctl00_somepanel_somecontainer_searchbox
.
request.form
contain raw html form control's values, including value generated client side version of searchbox
, actual generated id.
to solve issue, can:
- read
searchbox.text
property instead of readingform
object (probably best option) - replace server control pure client 1 (
<input type='textbox' id='searchbox'/>
- fix control id using
cliendidmode
, believe poor option
Comments
Post a Comment