c# 傳接值方法(一)

  • Share this:

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<script runat="server"> private void Button1_Click (object sender, System.EventArgs e) { string url; url = "addDB.aspx?name=" +TextBox1.Text + "&email=" +TextBox2.Text; Response.Redirect(url); }

</script>

<html xmlns=" http://www.w3.org/1999/xhtml "> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server" > <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="送出" onclick="Button1_Click"/> </div> </form> </body> </html>

<script runat="server"> void Page_Load(object sender, EventArgs e) { Label6.Text = Request.QueryString["name"]; } </script>

<asp:Label ID="Label6" runat="server"></asp:Label>


Tags: