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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:34:33+00:00 2026-06-11T00:34:33+00:00

How would I implement this: A user can enter any text in Textbox1 ,

  • 0

How would I implement this:

A user can enter any text in Textbox1, then click Submitbtn1 and then show results in a Gridview1. Clearbtn1 is used to clear all text in the Textbox1.

This would be all done in Visual Studio ASP.NET Web application.

This is what I have done so far:

namespace SearchApplication
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void EmptyTextBoxValues(Control parent)
        {
            foreach (Control c in parent.Controls)
            {
                if ((c.Controls.Count > 0))
                {
                     EmptyTextBoxValues(c);
                }
                else
                {
                     if (c.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
                     {
                          ((TextBox)(c)).Text = "";
                     }
                     else
                     {
                         //do nothing
                     }
                 }
             }
         }

         protected void Button2_Click(object sender, EventArgs e)
         {
             EmptyTextBoxValues(this.Page);
         }

         protected void Button1_Click1(object sender, EventArgs e)
         {

         }
     }
}
  • 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-06-11T00:34:34+00:00Added an answer on June 11, 2026 at 12:34 am

    One tip. Do not do :

    if (c.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox"))
                         {
                              ((TextBox)(c)).Text = "";
                         }  .  
    

    Do

    TextBox tx = c as TextBox. if(c != null) c.Text = "";  
    

    As for other things.
    When Submit Button is clicked you would get some data / create some data and bind it to the grid using

    grid.DataSource = myData;
    grid.DataBind();
    

    Regarding clearing the textbox. If you used normal Asp.net TextBox that you put outside of the Grid, like

    <asp:TextBox id="Textbox1" runat="server"/>
    

    You do not need EmptyTextBoxValues. You can just do Textbox1.Text = “”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to implement a map simmilar to this: http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/examples/advanced_example.html One of the
I have this piece of logic I would like to implement as a trigger,
I would like to implement a simple AR desktop application. This application should first
public abstract class MyAbs implements Comparable<MyAbs> This would work but then I would be
I am building a twitter application where a user can enter a tweet and
I would like to implement a facility like Orkut offers where user is able
I handle commands inside a RoutedCommand class that implements RoutedUICommand. This would help me
looking at dribbble, I have started to ask myself, how I would implement a
How would you implement a Listener that is queuing events that are executed at
How would I implement the accerelate/decerelating effect when scrolling as you would see near

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.