Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Coders How can i use global variables (except session,querystring,--)passing over our webforms while using masterpage when i using the followingcode -----------------------firstform.aspx------- protected void Button1_Click(object sender, EventArgs e) { int c = functionname; Server.Transfer("frmmain.aspx"); } public int functionname { get { return Convert.ToInt32(dropdownlist1.SelectedItem.Value); } } -------frmmain.aspx------------ <%@ Reference Page="firstform.aspx" %> firstform a1; a1 = (firstform )Context.Handler; int a=a1.functionname; ---------------- while doing this the following error is showing Unable to cast object of type 'ASP.frmmain_aspx' to type 'firstform'. Thanks Pradeep
Posted

1 solution

Dear friend,

Write Server.Transfer("frmmain.aspx",true) instead of Server.Transfer("frmmain.aspx");

And write following code for frmmain.aspx

-------frmmain.aspx------------

firstform a1= (firstform )PreviousPage;

int a=a1.functionname;

 

Enjoy....

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900