我需要将aaa.aspx中的一个DropDownList或者TextBox的值,传向bbb.asp
求教具体代码!!!
第一:如何转向asp页面?因为DropDownList需要<form runat=server>,不能直接POST,那最佳方法是什么?
第二:如何把控件或者变量的值,传出去?
代码指导下,谢谢大侠

解决方案 »

  1.   

    要是 post 可以在加个form表单也可以采用 get 的方式传值也可以用控件的 postbackurl 属性进行跳转
      

  2.   

    postbackurl、get都不能指向asp页面啊,也许我方法不对
    请教有没有能给个代码我看看?
    如何将aaa.aspx中的一个DropDownList或者TextBox的值,传向bbb.asp处理?
      

  3.   

    Get 就是把参数放在url中。跳转的时候url用
    http://****/bbb.asp?para=textbox的值。最好用HttpServerUtility.UrlEncode 编码一下。
      

  4.   

    <%@ Page Language="C#" Debug="true" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    </head>
    <body>
      <form id="form1" runat="server" action="bbb.asp">
      <asp:DropDownList ID="DropDownList1" runat="server">
      </asp:DropDownList>
      <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
      <asp:Button ID="Button1" runat="server" Text="Button" />
      </form>
    </body>
    </html>
    或者  <asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl="bbb.asp" />
    bbb.asp里面接收
    Request.Form("DropDownList1")
    Request.Form("TextBox1")
      

  5.   

    Response.Redirect 、PostBackUrl方法均返回:
    无法提供此类型的页。  
    说明: 由于已明确禁止所请求的页类型,无法对该类型的页提供服务。扩展名“.asp”可能不正确。 请检查以下的 URL 并确保其拼写正确。  
    请问何意?如何处理?配置问题?代码如下,求解:
    <form id="form1" runat="server">
       <asp:SqlDataSource ID="SqlDS1" runat="server"  
      ConnectionString="<%$ ConnectionStrings:LimaxOAConnectionString %>"  
      ProviderName="<%$ ConnectionStrings:LimaxOAConnectionString.ProviderName %>">
       <SelectParameters>
       <asp:Parameter DefaultValue="1" Name="DeptLv" Type="String" />
       </SelectParameters>
       </asp:SqlDataSource>
       <asp:DropDownList ID="DPL1" runat="server" AutoPostBack="True"  
      DataMember="DefaultView" DataSourceID="SqlDS1" DataTextField="DeptName"  
      DataValueField="DeptID" EnableTheming="True">
       </asp:DropDownList>
       <asp:TextBox ID="txt1" runat="server" Width="511px"></asp:TextBox>
       <asp:HiddenField ID="HiddenField1" runat="server" />
    </form>
    <asp:input type="button" value="提交到asp" onclick="subasp()"></asp:input>
    <iframe id="iframeSaveForm" name="iframeSaveForm" src="" width="100%" height="0"></iframe>
    <script type="text/javascript">
       var strFormID = '<%=form1.ClientID%>';
       function subasp() {
       document.getElementById(strFormID).action = "HumanAddProcessing.asp?Step=2";
       document.getElementById(strFormID).target = "iframeSaveForm"; // 隐藏一个iframe作为action
       document.getElementById(strFormID).submit();
       }
    </script>始终无法转向HumanAddProcessing.asp
      

  6.   

    是我自己问题,用PostBackUrl="http://222.82.228.150/hr/HumanAddProcessing.asp?Step=2"就解决了,不带全路径就不行,问题性质变了啊,呵呵
      

  7.   

    本帖最后由 net_lover 于 2012-06-06 20:38:51 编辑