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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:49:26+00:00 2026-05-24T18:49:26+00:00

I am using ASP.NET, C#, Sql Server 2005 for my project and I’m using

  • 0

I am using ASP.NET, C#, Sql Server 2005 for my project and
I’m using the repeater control to form a table of users that are a member of a site and a button next to each user so that they can be added to your friends list. I have everything set up except I dont know how to get the specific info of each row after a button click. I mean,

How to send a friend request to a person whose username is displayed besides the button? or
How to access the the displayed username besides the button so that I can use it for my code?

My Script

<asp:Repeater ID="myrepeater" runat="server">
        <HeaderTemplate>
            <table style="font: 8pt verdana">
                <tr style="background-color:#3C78C3">
                    <th>Search Result</th>
                </tr>

        </HeaderTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <%#DataBinder.Eval(Container,"DataItem.allun")%>
                    <asp:Button ID="Button1" runat="server" Text="Button" />
                </td>
           </tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>

Code Behind

protected void btnSearch_Click(object sender, EventArgs e)
{
    con.Open();
    if (txtSearch.Text != "")
    {
        SqlDataAdapter mycommand = new SqlDataAdapter("select * from WebAdminTable where allun='" + txtSearch.Text + "'", con);
        DataSet ds = new DataSet();
        mycommand.Fill(ds);
        myrepeater.DataSource = ds;
        myrepeater.DataBind();
    }
    else
    {
        //msgbox for entering value
    }
    con.Close();
}

protected void btnAddToMyFList_Click(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-05-24T18:49:27+00:00Added an answer on May 24, 2026 at 6:49 pm

    You can bind the userName to a label control and then you can access the value of the label control on the click of button like…

    protected void btnAddToMyFList_Click(object sender, EventArgs e)
    {
      Button btnAddToMyFList = (Button)sender;
      Label label = (Label)btnAddToMyFList.Parent.FindControl("LabelId");
      String labelText = label.Text; //userName of clicked row
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose, I am about to start a project using ASP.NET and SQL Server 2005.
I maintain a legacy ASP.Net Web application (using .Net 2.0 + SQL Server 2005
I need to write a web application using SQL Server 2005, asp.net, and ado.net.
I'm developing an ASP.NET app (C#) that connect to SQL Server 2008 using ADO.NET
Project being built on ASP.net v 2 VB.net IIS 6 SQL Server 2005 database
I am using C# ASP.NET on Visual Studio 2005, as well as SQL Server
I am starting a new project using C# and ASP.NET 3.5 with SQL Server
I am working on a project in ASP.Net, and I am using SQL Server
I am using ASP.NET with SQL Server 2005. My date get saved in the
In am testing a application which is created using asp.net and sql server 2005.

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.