日期:2014-05-18  浏览次数:20634 次

wpf页面传值问题,wpf高手请指点!
我在页面中想在点链接的时候传参,如何传参,谢了!!

------解决方案--------------------
UP
------解决方案--------------------
页面间传值:WebForm1-> WebForm2
public class WebForm1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
private void Button1_Click(object sender, System.EventArgs e)
{
Server.Transfer( "WebForm2.aspx ");
}
public string Name
{
get{return this.TextBox1.Text.Trim();}
}
public string Email
{
get{return this.TextBox2.Text.Trim();}
}
}
public class WebForm2 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
private void Page_Load(object sender, System.EventArgs e)
{ //create instance of source web form
WebForm1 wf1;
//get reference to current handler instance
wf1=(WebForm1)Context.Handler;
Response.Write( " <script> alert( 'Name: "+wf1.Name+ " '); </script> ");
Response.Write( " <script> alert( 'Email: "+wf1.Email+ " '); </script> ");
Label1.Text=wf1.Name;
Label2.Text=wf1.Email;
}
}

------解决方案--------------------
也可以使用URL传参:

Response.Redirect( "temp.aspx?SP_ID=strPID&WYEAR=strWyear&Type=strType ");
其中strPID & strWyear & strType是需要传递的参数值
------解决方案--------------------
还可将参数值放在Session中,也可以将其放在Hidden中
------解决方案--------------------
楼主问的是WPF,楼上居然兴致勃勃的回了3个asp.net:-)
------解决方案--------------------
楼主居然开始玩.NET3.0了
------解决方案--------------------
我也很想知道怎么传