type Casting in C#
I want to transfer data from one webpage to another webpage using Context.handler..
I got code from MSDN site like, in the calling form i wrote
public WebForm1 webform1_instance;
WebFrom1 webform1_instance = (WebForm1)Context.Handler
label2.text = webform1_instance.username_textbox.text.Tostring();
Then this coding gives error for : INVALID TYPE CASTING IN C#
FOR
WebFrom1 webform1_instance =(WebForm1)Context.Handler
nhow what should i do ,, please help me out.......
[562 byte] By [
syParth] at [2007-12-29]
AFAIK you can't use Handler for that. The handler will be the handler for the current request and not necessarily a web page. You should instead rely on traditional methods for passing data between pages such as using Items for same-request information, Session for cross-request information or query string for general information.
Therefore your cast, although syntactically legal, is not valid and will never work.
Michael Taylor - 2/7/07
http://p3net.mvps.org
but this code is suggested by the msdn site... and woudl you please tell me , what is the reason , for not working? And please , if you can ,tel me the code by which i can get that problem solved..
I wnat to transfer a textbox's string to another page's label.text...
thanx verymuch..