zoukankan      html  css  js  c++  java
  • html 向aspx 页面传值

    csl_terry(csl_terry) 17:07:50
    www.abc.com/a.html 想通过form action=www.def.com/b.aspx 传值到b.aspx,但这样取不到值,有什么方法从html传值到aspx呢?
    oliver(Oliver) 17:10:09
    用URL不行吗
    oliver(Oliver) 17:10:27
    或session
    Leander() 17:10:36
     action=www.def.com/b.aspx  这个应该能取到值吧。。
    Leander() 17:11:09
    应该可以取到form 里面 input标签的值吧。。
    Leander() 17:11:54
    不过好像在 b.aspx 不能用那个querystring来取。。
    Leander() 17:12:23
    好像有个 request. ???  params 类似的
    csl_terry(csl_terry) 17:12:44
    b。aspx只取了本页面的东西
    Leander() 17:14:32
    试试这个。。string value_from_html = Request.Params["input_tag_id"];
    Leander() 17:15:28
    提交这个 action=www.def.com/b.aspx  的时候,  要传过来的值要放在一个 <input id="input_tag_id" type=??? />
    Leander() 17:15:53
    没试过,  猜的
    csl_terry(csl_terry) 17:15:50
    Request.Params 里面没东西
    csl_terry(csl_terry) 17:21:13
    假如是同一个域里面的aspx页面,.net2.0有个<%@ Reference VirtualPath="xxx.aspx"  %>。 html就不知道怎么搞了
    Leander() 17:27:36
    sorry,  这个<input name="input_tag_id" type=??
    Leander() 17:27:54
    input那个用name代替id试试
    oliver(Oliver) 17:29:16
    Request.QueryString应该也可以吧
    Leander() 17:29:39
    QueryString 是去url后面的param的。。  猜的
    csl_terry(csl_terry) 17:29:44
    nput那个用name代替id试试,好像可以,试下先
    Leander() 17:31:06
    或者 Request.Form["input_tag_id"]; 也行。。
    oliver(Oliver) 17:32:12
    这个为什么行Request.Form["input_tag_id"]
    Leander() 17:32:48
    取出提交过来的form里面所有input的值吧。。
    Leander() 17:33:27
    Request.Params 就什么都取。。
    oliver(Oliver) 17:33:43
    Request.Form.Count=0
    oliver(Oliver) 17:33:49
    怎么取?
    Leander() 17:34:14
    Request.Params  连url,  form,  cookie都取的。。
    Leander() 17:35:15
    oliver(Oliver) 17:33:43
    Request.Form.Count=0
    --- 可能是你提交过来的form里面没有input 标签。。
    oliver(Oliver) 17:35:25
    晕。。
    csl_terry(csl_terry) 17:37:00
    input那个用name代替id,这样就行了,很奇怪,是不是net有id的只取本页面的。name就所有的?
    Leander() 17:38:50
    你在其他html 提交过到 b.aspx 的, 应该连本页面的也取不到的吧。。
    csl_terry(csl_terry) 17:42:08
    request里面只有其他html的东西。
    Leander() 17:43:48
    只有点击本页面的按钮,  即触发postback时, 才能取到本页面的值,  否则,  本页面的值都是默认的。。
    Leander() 17:46:14
    我这里默认的意思是指,  本页面的所有控件的状态跟你直接在url进入本页面的状态是一样的。。
  • 相关阅读:
    SendMessage 和 SendMessageTimeout 可能存在异常(除超时)
    类型强制转换符 与 + 符的优先级
    茵茵的第一课
    C小加 之 随机数
    16进制的简单运算
    交换输出
    计算球体积
    a letter and a number
    A problem is easy
    Coin Test
  • 原文地址:https://www.cnblogs.com/zitjubiz/p/1301593.html
Copyright © 2011-2022 走看看