Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 938711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:41:08+00:00 2026-05-15T21:41:08+00:00

I am using C# + VS2008 + .Net 3.5 + ASP.Net + IIS 7.0

  • 0

I am using C# + VS2008 + .Net 3.5 + ASP.Net + IIS 7.0 + ADO.Net + SQL Server 2008. I want to develop an ASP.Net aspx page which has the following function,

1 It could accept 3 Url parameters param1, param2 and param3, and the request looks like this,

http://example.org/foo.aspx?parame1=abc&param2=def&param3=ghi

2 When the page is responsed to client browser, I want to display a text input and a submit button nearby in the result html page, and value of text input is the same as param1, in this sample, abc will be displayed in text box, in the browser address bar, I want to keep the original long url http://example.org/foo.aspx?parame1=abc&param2=def&param3=ghi;

3 When the user change the value in text input, and click submit button, I want to send this request again to foo.aspx, and changing the param1 value to the value which user entered in text input, and at the same time, keep values of parame2 and param3 the same as last request’s response. For example, when user requests http://example.org/foo.aspx?parame1=abc&param2=def&param3=ghi, and the page displays, when user changes text input from abc to google, the new request will be http://example.org/foo.aspx?parame1=google&param2=def&param3=ghi

Any reference samples? My question is I do not know how to implement so many functions in one aspx page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:41:08+00:00Added an answer on May 15, 2026 at 9:41 pm

    If you want the browser address bar to show the updated URL you can allow the button click to postback to the server and then you handle the TextChanged event of the textbox.

    In the TextChanged event handler you build the new URL with the changed querystring arguments and use Response.Redirect to redirect the browser to the new URL.

    Here is a quick an dirty example.

    Given a ASPX page with a textbox and a button, somthing like this

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
    
    <!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 runat="server">
      <title></title>
    </head>
    <body>
    
      <script type="text/javascript">
        function requery() {
          var query = location.search.substring(1);
          var pairs = query.split("&");
          var param1Value = document.getElementById("txtParam1").value;
    
          url = "/Default.aspx?param1=" + param1Value;
          for (var i = 0; i < pairs.length; ++i) {
            var pair = pairs[i];
            if ((pair.indexOf("param1") != 0) && (pair.length > 0)) {
              url += "&" + pair;
            }
          }
          location.href = url;
        }
      </script>
    
      <form id="form1" runat="server">
      <div>
        <asp:TextBox ID="txtParam1" runat="server" OnTextChanged="txtParam1_TextChanged"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Submit" />
        <input type="button" value="Client Action" onclick="requery()" />
      </div>
      </form>
    </body>
    </html>
    

    Your code behind to handle the TextChanged event of the textbox could do the following.

    using System;
    using System.Text;
    
    namespace WebApplication1
    {
      public partial class _Default : System.Web.UI.Page
      {
        protected void Page_Load(object sender, EventArgs e)
        {
          if (!IsPostBack)
          {
            txtParam1.Text = Request.QueryString["param1"];
          }
        }
    
        protected void txtParam1_TextChanged(object sender, EventArgs e)
        {
          // Build the new URL with the changed value of TextBox1      
          StringBuilder url = new StringBuilder();
          url.AppendFormat("{0}?param1={1}",
            Request.Path, txtParam1.Text);
    
          // Append all the querystring values that where not param1 to the
          // new URL
          foreach (string key in Request.QueryString.AllKeys)
          {
            if (string.Compare(key, "param1", true) != 0)
            {
              url.AppendFormat("&{0}={1}", key, Request.QueryString[key]);
            }
          }
    
          // Redirect the browser to request the new URL
          Response.Redirect(url.ToString());
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.