开发者

Problem getting value of a ASP.NET form field from httpContext

I have declared a form input in my ASP.NET ascx file:

<input type="hidden" id="hidServiceType" name="hidServiceType" val开发者_开发问答ue="somevalue" />

And in the web service / web method, I am trying to get the value of this

HttpContext postedContext = HttpContext.Current;
serviceType = postedContext.Request.Form["hidServiceType"];

I can dig down into postedContext.Request.Form and see 2 keys one being "hidServiceType" but "serviceType" variable = "";

What am I missing, this seems so trival.


Why don't you just add a runat="server" attribute to your input field and then access it as you do everything else from the code-behind?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜