asp.net 获取url参数值代码

作者:袖梨 2022-06-25

asp教程.net 获取url参数值代码

file: default.aspx.cs

using system;
using system.data;
using system.configuration;
using system.collections;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;

public partial class querystringsender : system.web.ui.page
{
    protected void page_load(object sender, eventargs e)
    {

    }
  protected void cmd_click(object sender, eventargs e)
  {
    response.redirect("nextpage.aspx" + "?version=" +
        ((control)sender).id);
  }
}

file: nextpage.aspx

<%@ page language="c#"
         autoeventwireup="true"
         codefile="nextpage.aspx.cs"
         inherits="querystringrecipient" %>



    untitled page


   


   

                   runat="server"
              
              
               font-names="verdana"
               font-size="large"
               enableviewstate="false">
   

   

   


file: nextpage.aspx.cs

using system;
using system.data;
using system.configuration;
using system.collections;
using system.web;
using system.web.security;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.webcontrols.webparts;
using system.web.ui.htmlcontrols;

public partial class querystringrecipient : system.web.ui.page
{
    protected void page_load(object sender, eventargs e)
    {
    lbldate.text = "the time is now:
" + datetime.now.tostring();
    switch (request.querystring["version"])
    {
      case "cmdlarge":
        lbldate.font.size = fontunit.xlarge;
        break;
      case "cmdnormal":
        lbldate.font.size = fontunit.large;
        break;
      case "cmdsmall":
        lbldate.font.size = fontunit.small;
        break;
    }
    }
}

file: default.aspx

<%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="querystringsender" %>



    untitled page


   


   

                    runat="server"
                text="large text version"
                onclick="cmd_click">
   

 
 
   

   


相关文章

精彩推荐