我是新手不知道如何在asp.net中的脚本语言中写web页传递和接收参数,请各位大虾详细介绍,最好有脚本范例,谢谢

解决方案 »

  1.   

    detail.aspx?id=1
    string id;
    Request.QueyString.Get("id");我也是新手呵,不知道你问的是不是这个意思哈~
      

  2.   

    我有2个页 webform1.aspx 和webform2.aspx
    在webform1.aspx中有一个datagrid1 在datagrid1里新增一个超级链接列,我想点击此列
    得到这一个行的 其中一个字段值(字段名 NOTICE_ID)我现在是在属性生成器中的 列标签页中超级链接列的url格式字符串中写的webform2.aspx?id=NOTICE_ID 我如何写才能让字符notice_id 变成它所代表的值呢?
      

  3.   

    <%@ Import Namespace="System.Data.OleDb" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
    <HTML>
    <HEAD>
    <title>投票系统</title>
    <script language="C#" runat="server">
    DataSet ds;
    public void Page_Load(object sender,EventArgs e)
    {
    string connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("/") + "/tpxt1/sj/sj.mdb";
    OleDbConnection conn = new OleDbConnection(connStr);
    conn.Open();
    string sql="select tp_id,tp_bt from tp where tp_sy=1";
    OleDbCommand  comm=new OleDbCommand(sql,conn);
    OleDbDataReader Reader1=comm.ExecuteReader();
    if (Reader1.Read())
    {
    int sj=Reader1.GetInt32(0);
    sjid.Value=sj.ToString();
    tpbt.Text=Reader1.GetString(1);
    Reader1.Close();
    ds=new DataSet();
    string sql2="select tp_id,tp_bt from tp where tp_sj="+sj;
    OleDbDataAdapter  comm2=new OleDbDataAdapter(sql2,conn);
    comm2.Fill(ds,"tp");
    xz.DataSource=ds;
    xz.DataBind();
    }
    else
    {
    Reader1.Close();
    }
    conn.Close();
    }
    public void ck1(object sender, EventArgs e)
    {
    Response.Write ("<script>window.open('xstp.aspx?sj1="+Request.Params["sjid"].ToString()+"',null,'width=550,height=250,scrollbars=yes,top=100,left=200');<"+"/"+"script>");
    }public void tj1(object sender, EventArgs e)
    {
    if (Request.Params["xz"]==null)
    {
    Response.Write ("<script>alert('您还没有选择任何选项');<"+"/"+"script>");
    }
    else
    {
    for (int i=0;i<xz.Items.Count;i++)
    {
    if(Int32.Parse(xz.Items[i].Value)==Int32.Parse(Request.Params["xz"]))
    {
    xz.SelectedIndex=i;
    }
    }
    Response.Write ("<script>window.open('xstp.aspx?sj1="+Request.Params["sjid"].ToString()+"&xzid="+Request.Params["xz"].ToString()+"',null,'width=550,height=250,scrollbars=yes,top=100,left=200');<"+"/"+"script>");}
    }
    </script>
    <script language="javascript">
    function all1()
    {
    var obj = document.all.tags("INPUT");
    if (document.all["qx"].value=="全选")
    {
    for(i=0;i<obj.length;i++)
    {
    if(obj[i].type=="checkbox")
    {
    obj[i].checked = true;
    }
    }
    document.all["qx"].value="取消";
    }
    else
    {
    for(i=0;i<obj.length;i++)
    {
    if(obj[i].type=="checkbox")
    {
    obj[i].checked = false;
    }
    }
    document.all["qx"].value="全选";
    }
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link href="ys/ys.css" rel="stylesheet" type="text/css">
    </HEAD>
    <body>
    <form runat="server">
    <table width="20%" border="0" align="center" cellpadding="3" cellspacing="0">
    <tr>
    <td height="30" align="center" class="bt"><asp:label ID="tpbt" runat="server"></asp:label></td>
    </tr>
    <tr>
    <td>
    <asp:CheckBoxList ID="xz" runat="server" DataSource="<%# ds %>" DataTextField="tp_bt" DataValueField="tp_id" >
    </asp:CheckBoxList></td>
    </tr>
    <tr>
    <td align="center">
            <asp:Button ID="tj" OnClick="tj1" Text="提交" runat="server" />
    <asp:Button ID="ck" Text="查看结果" OnClick="ck1" runat="server" />
    <input type="button" id=qx name="qx" value="全选" OnClick="all1()"></td>
    </tr>
    </table>
    <input type="hidden" id="sjid" runat="server">
    </form>
    </body>
    </HTML>