I want to be able to customize a page according to the id inputted in the URL http://CommonWA/AnnoucementDetail.aspx?I... like if I am on one page and I type 3 into a forum box labeled "id" or something and it goes to another page I want to make it so that the page is customized according to the id supplied. but I don't know how to make it so that it sets the value for the parameter in the URL, where would I go about coding this in the ASP.NET C# page? All I know is that it has something to do with the GET and the pageLoad method... I think
any help would be greatly appreciated, thanx in advanced :-)
Quesion about setting parameters in a ASP.NET C# page?
in the codebehind of the AnnoucementDetail.aspx, you would put something like this to get the parameter value:
private int id; //declare a var
Page_Load(...){
if (!Page.IsPostBack){
id = int.Parse(Request.QueryString("ID"));
//now the id var will contains whatever number you pass to it
//then just do some conditional checking on the id here to do whatever customization needed.
}
}
hope this helps.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment