C#private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect("http://localhost/index.aspx?Button=1", true);
}private void Button2_Click(object sender, System.EventArgs e)
{
Response.Redirect("http://localhost/index.aspx?Button=2", true);
}
{
Response.Redirect("http://localhost/index.aspx?Button=1", true);
}private void Button2_Click(object sender, System.EventArgs e)
{
Response.Redirect("http://localhost/index.aspx?Button=2", true);
}
<script language=javascript>
function button1_onClick()
{
window.location="http://localhost/index.aspx?Button=1";
}
function button2_onClick()
{
window.location="http://localhost/index.aspx?Button=2";
}
button和hyperlink的区别只是button要提交表单的数据
而提交表单数据的页面由form的action属性定死拉
用上面大家的方法只能在第二个页面接收到button参数
form里面的其它变量都不会有了。
如果不需要提交表单,那就直接用hyperlink就可以了
想将两步合为一步,作为超级联接。应该怎么写?
属性url="index.aspx";
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect(string.Format("http://localhost/index.aspx?Button=(0)", ButtonID), true);
}
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Redirect(string.Format("http://localhost/index.aspx?Button={0}", ButtonID), true);
}
可以直接这么写吗?