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 6888523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:01:45+00:00 2026-05-27T06:01:45+00:00

My problem is as follows: I am adding a variable to the URL that

  • 0

My problem is as follows:

I am adding a variable to the URL that should trigger a search when the page loads, depending on what is in the variable. If you navigate to that same page without the variable then it shouldn’t do anything special on page load. I figured that the following would do the trick:

protected void Page_Load(object sender, EventArgs e)
{

    if (Page.Request.QueryString["cell"] != null)
    {
        txtCell.Text = Page.Request.QueryString["cell"];
        Lookup_Cell(Page.Request.QueryString["cell"]);

        //BUGGED, this keeps running when i try a new search
        //Page.Request.QueryString["cell"] = null;
    }else{
        //do nothing, empty string
    }

}

This worked like a charm, but i have a search button of the form that is supposed to call the Lookup_Cell method for a cell you specify in a TextBox. i need to make Page.Request.QueryString empty so next time the page loads it won’t fire this special OnLoad. I tried:

Page.Request.QueryString["cell"] = null;

but that didn’t work. I looked for other methods, but can’t find a definite answer.

  • 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-27T06:01:46+00:00Added an answer on May 27, 2026 at 6:01 am

    You can make a simple PostBack check and when there is a post back, get the string from your text box.

    string cFinalQueryString = "";
    
    if(!IsPostBack)
    {
        if (Page.Request.QueryString["cell"] != null)
        {
            cFinalQueryString = Page.Request.QueryString["cell"];
        }else{
            //do nothing, empty string
        }
    }
    else
    {
        cFinalQueryString = txtCell.Text;
    }
    
    txtCell.Text = cFinalQueryString;
    Lookup_Cell(cFinalQueryString);
    

    Or alternative, when you have post back, redirect to new page with new ‘cell’ query

    if(IsPostBack && Page.Request.QueryString["cell"] != txtCell.Text)
    {
        Responce.Redirect("CurrentPage.aspx?cell=" + UrlEncode(txtCell.Text), true);
        return ;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem 2b goes as follows: 2b. For each subject show the first year that
Scroll.js is used for #bird block, which follows the page scrolling. The main problem
When I write a C program, I encountered a problem that is as follows:
got a bit of a problem with Zend not adding the base url into
This problem follows on from a previous question . When I run the following
The main problem is as follows: I did my code in console application and
Our situation is as follows, but I'm curious about this problem in any situation.
I have a mysql problem, my query looks as follows but not complete SELECT
I run into follow problem. Did I miss anything? Association.all().count() 1 Association.all().fetch(1) [Association(**{'server_url': u'server-url',
I have small problem. What I want to achieve is adding sum of values

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.