頁面之間傳值的幾種方法1.get方式
傳送頁**:response.redirect("webforma2.aspx?name=" + textbox1.text);
接收頁**:
this.textbox1.text = request["name"];
"name"];
"name"];
2.使用記憶體變數
傳送頁**:
接收頁**:
3.post方式
傳送頁**:
接收頁**:
if (request.form["txtname"] != nul
l)注意:中不能帶runat="server".否則不起作用.
中的mothod="post"
4.靜態變數
傳送頁**:
//定義乙個公共變數
public static string str = "";
protected void button1_click(object sender, eventargs e)
接收頁**: this.textbox1.text = webformd1.str;
5.context.handler獲取控制項
傳送頁**:
andy" runat="server">
click="button1_click" />
//button1_click事件**
response.redirect("webforme2.aspx");
接收頁面**:
//獲取post過來的頁面物件
if (context.handler is webforme1)
6.context.handler獲取公共變數
傳送頁**:
//定義乙個公共變數
public string strname = "andy";
protected void button1_click(object sender, eventargs e)
7.context.items變數
傳送頁**:
protected void button1_click(object sender, eventargs e)
接收頁**:
//獲取post過來的頁面物件
if (context.handler is webformg1)
本文抄自《亮劍.net>,記一下筆記!
介面傳參幾種方式
querystring 最簡單,url中傳遞過來的引數,可以用request獲取,也可以在api的引數中獲取 public void action string a form 用於接收表單資料,例如ajax中提交過來的資料 請求 ajax success function d 接收 將引數放在請求內...
mybatis傳參的幾種方式
1,param 參考文章 select select s id id,s name name,class id classid from student where s name and class id publicstudent select param aaaa string name,par...
vue路由傳參的幾種方式
方案1 url表現為 直接呼叫 router.push 實現攜帶引數的跳轉 this.router.push 方案1,需要對應路由配置如下 很顯然,需要在path中新增 id來對應 router.push 中path攜帶的引數。在子元件中可以使用來獲取傳遞的引數值。this.route.params...