我有一个使用会话变量从按钮的代码将变量发送到DataGrid另一页选择会话变量与IF语句
protected void Button1_Click(object sender, EventArgs e)
{
int agent = int.Parse(txtAgencyCode.Text);
Session["para1"] = agent;
Button1.Attributes.Add("onclick", "window.open('http://localhost:50771/WebSite4/Datagrid.aspx'); return false;");
}
protected void btnTitleSearch_Click(object sender, EventArgs e)
{
Session["para2"] = txtTitleSearch.Text;
btnTitleSearch.Attributes.Add("onclick", "window.open('http://localhost:50771/WebSite4/Datagrid.aspx'); return false;");
}
上与其他网页上的代码一个
protected void Page_Load(object sender, EventArgs e)
{
int field1 = (int)(Session["para"]);
localhost.Service ws = new localhost.Service();
GridView1.DataSource = ws.GetJobsByAgencyID(field1);
GridView1.DataBind();
}
我无法弄清楚的是如何使if语句(或者即使它将成为使用if语句)来决定将哪个参数传递给我的数据网格。
有关信息,将在默认页面上显示另外3至4个控制器(其中只有一个将被激活),参数将采用不同类型。
编辑 很抱歉,你都发现我的问题很难理解,即时没有任何手段使某一设备专业甚至什么宥可致电主管。 詹姆斯希尔和拉维给了我很多我以后的(需要测试,但看起来像)。感谢所有的尝试:D
你的病情会是怎样? – 2012-01-31 15:14:49
这是什么我甚至没有 – jadarnel27 2012-01-31 15:18:25
@ jadarnel27你让我笑得很难! – 2012-01-31 15:21:31