开发者

ASP.NET getting POST values from another page

开发者 https://www.devze.com 2023-03-30 14:41 出处:网络
I want t开发者_开发知识库o get the post values from another page, I\'ve used this: Request.Form[\"myFieldName\"]

I want t开发者_开发知识库o get the post values from another page, I've used this: Request.Form["myFieldName"]

problem is after debugging, the field names, have all that "ct$100PlaceHoldermyFieldName" in it, how do I get my field value?

The form on the other page, needs all that automatic ASP.NET (I think?) As it is uses validators and client-side-validation.

Thanks!


I have done this before but used ServerTransfer to the next page. Then you use PreviousPage.FindControl to get the values of the controls. Not sure if this will help your situation?

Take a look here for some more info. http://geekswithblogs.net/ranganh/archive/2005/04/25/37633.aspx


I hope it helpful for you Use like this

<asp:Button ID="Button1" PostBackUrl="~/TargetPage.aspx"  runat="server" Text="Submit" />

PostBackUrl="~/TargetPage.aspx"

more details here http://msdn.microsoft.com/en-us/library/ms178140.aspx .

to get values Request.Form check more details here http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx


You can use NameValueCollection to retrieve Http Posted Forms.

NameValueCollection collection = Request.Form;
string fieldName;
if (!string.IsNullOrEmpty(collection["fieldName"]))
{
  fieldName = collection["fieldName"];
}
0

精彩评论

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