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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:33:13+00:00 2026-05-27T09:33:13+00:00

Wondering where I’m going wrong here. I’m page loads but when I click on

  • 0

Wondering where I’m going wrong here. I’m page loads but when I click on the search (after I type something in the last name field) it just clocks and clocks.

Here’s my aspx.cs page:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;

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

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        DataSet ds = new DataSet();

        using (SqlConnection con = new SqlConnection("SERVER=ServerName;Trusted_Connection=Yes;DATABASE=DBNAME"))
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.CommandText = "customerSearchStoredProc";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@lName", lNameTextbox.Text);
                cmd.Connection = con;

                SqlDataAdapter adapter = new SqlDataAdapter();
                adapter.SelectCommand = cmd;
                adapter.Fill(ds);

            }
            con.Close();
        }
        GridView1.DataSource = ds;
        GridView1.DataBind();

        /*SqlDataAdapter adp = new SqlDataAdapter("customerSearchStoredProc", con);
        adp.SelectCommand.CommandType = CommandType.StoredProcedure;
        adp.SelectCommand.Parameters.Add(new SqlParameter("@lName", System.Data.SqlDbType.Text));
        //adp.SelectCommand.Parameters.Add(new SqlParameter("@State", System.Data.SqlDbType.Text));
        adp.SelectCommand.Parameters["@lName"].Value = lNameTextbox.Text;
        //adp.SelectCommand.Parameters["@State"].Value = StateTextbox.Text;

        adp.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();*/


    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
}

Here’s my aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="_Default" %> <%@ OutputCache Duration="1" VaryByParam="none" %>

<!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>MSS Archive Page</title> </head> <body>
    <form id="form1" runat="server">
        <asp:Label ID="Label1" Text="Last Name"  runat="server" />
        <asp:TextBox ID="lNameTextbox" runat="server"></asp:TextBox>
        <asp:Label ID="Label2" Text="First Name"  runat="server" />
        <asp:TextBox ID="fName" runat="server" ></asp:TextBox>
       <!-- <asp:Label ID="Label3" Text="Street"  runat="server" />
        <asp:TextBox ID="Street" runat="server" AutoPostBack="True"></asp:TextBox><br />
        <asp:Label ID="Label4" Text="City"  runat="server" />
        <asp:TextBox ID="City" runat="server" AutoPostBack="True" ></asp:TextBox> -->
        <asp:Label ID="Label5" Text="State" runat="server" />&nbsp;<!-- <asp:TextBox ID="State" runat="server" AutoPostBack="True"></asp:TextBox> -->
        <asp:TextBox ID="StateTextbox" runat="server" ReadOnly="True">MA</asp:TextBox>
        &nbsp;&nbsp;
        <asp:Label ID="Label6" Text="Zip"  runat="server" />
        <asp:TextBox ID="Zip" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" PostBackUrl="~/Default.aspx" Text="Search" OnClick="Button1_Click"  /><br />
        OR<br />
        <asp:Label ID="Label7" Text="Policy"  runat="server" />
        <asp:TextBox ID="Policy" runat="server"></asp:TextBox>
        <asp:Label ID="Label8" Text="Account"  runat="server" />
        <asp:TextBox ID="Account" runat="server"></asp:TextBox>&nbsp;<br />
        &nbsp;<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" OnDataBinding="Button1_Click" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" >

        </asp:GridView>
        &nbsp;&nbsp;<br />
        &nbsp; &nbsp;
        &nbsp;&nbsp;

    </form> </body> </html>

Thanks for the help!

  • 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-27T09:33:13+00:00Added an answer on May 27, 2026 at 9:33 am

    Your databinding is calling the on click.

    OnDataBinding="Button1_Click"
    

    In the on click you call databind.

    GridView1.DataBind();   
    

    To me that looks like a loop going on forever.

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

Sidebar

Related Questions

Wondering if I need to do something in my swf to be able to
Wondering if anyone can help me with this annoying but trivial (in terms of
Wondering if anyone can assist.. I am adding some jquery to my site, but
Wondering how to substring the last two characters quickly in Java?
Wondering if someone can answer something that has stumped me. I have a Timer
Wondering if this is possible or something with this effect. public class MyModel {
Wondering what to do about this. Googling but can't seem to find anything. I
wondering if someone could help me, but at the same time hopefully I can
Wondering if there's someone here with some experience with gzip format. I have a
Wondering if I'm going about this the right way or not. I have 3

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.