Hey All :)
Im new to asp.net, but come from a background of php so all my asp is in C#.
Now i have a ASP.NET cms system that i am currently making changes to. Now what i have is filename.aspx which up the top calls header.aspx, and i am trying to pass a string from filename.aspx.cs to header.aspx.cs (the name of the header graphic i want to set).
In php i would just set the variable, and in the header file i would call the variable in via global $varName; but in asp this doesnt seem to be working (go figure :p)
Hope it makes sense, all feedback appreciated.
1. you can pass it through the QueryString -
perhaps while you redirect to header.aspx do something like response.redirect("header.aspx?imgfile=" + theVariableHoldingName);
and in the header.aspx.cs do something like (in the Page_Load): string nameOfImage = Rquest.QueryString("imgfile");
2. you can use Session also:
in filename.aspx - Session.Add("imgfile",theVariableHoldingName);
and in header.aspx - string nameOfImage = Session["imgfile"];
ben14:
In php i would just set the variable,
just set the session object where you would set the variable as.. Session["myData"] = value
ben14:
and in the header file i would call the variable in via global $varName
and get the value of that session object where you would call the variable in via global $varName as... myValue = Session["myData"]
dont forget to cast the value... as Session returns an Object..
hope it helps./.
thanks for that :) should work fine.
cheers
0 comments:
Post a Comment