开发者

Is there a way to return a value in the Response?

The problem is I redirect to a sub page from the main page by passing开发者_StackOverflow中文版 a few values in Request. I need to get back the value I got from manipulating values I sent in request and I don't need to store value in Session.


You can use the PreviousPage property, depending on how you got to the new page.


There are a number of things you can do:

  • Page.Request["ID_Of_Control_You_Are_Interested_In"] will get you a value that you need.

  • If you Server.Transfer to the page you can call Context.Handler, cast it to the page you come from and traverse the controls collection to get your value.... (similar to PreviousPage property)

You can also inspect the Query string parameters sent in the request too:

  • Page.Request.QueryString("Param_To_Inspect")


you can return your values as JSON as the response and then using a jquery to get the data


You have three options: Query String Parameters, Cookies and Session State

Query String Parameters: http://www.aspnet101.com/2007/11/using-the-querystringparameter/

This is a good way to pass data between pages. It's the most commonly used and is limited to the max length of the url.

Cookies : http://msdn.microsoft.com/en-us/library/ms178194.aspx This is a good method. It also has a size limitation. The advantage of cookies is you can persist data that can span visits to your site.

Session State : http://msdn.microsoft.com/en-us/library/ms178581.aspx This an ok method, I'd use the two methods above before I would use session state. In my experience you can get into trouble very fast with Session state.

To answer your question: You can take the value from the request and load it into a TextBox. Then on the web page, the user edits the value and clicks a save button, which posts the changed value back to the server.

Or you could use javascript to post the value back to the server.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜