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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:09:47+00:00 2026-06-07T11:09:47+00:00

Ok so I have a list of LinkButton’s that upon being clicked are creating

  • 0

Ok so I have a list of LinkButton’s that upon being clicked are creating more LinkButton’s inside of a table to do postback. For example, Each user has a list of activities or jobs. So when that user is clicked it creates a list of their jobs in a table. These jobs then need to do postback to get their respected content.

C# Code:

protected void Page_Load(object sender, EventArgs e) {
    try {
        lstUsers = GetUsers();
        AddLinkButton("all", "All", tabList, link_Command);
        foreach (var item in lstUsers) {
            AddLinkButton(item.UID.ToString(), item.Name, tabList, link_Command);
        }
    } catch (Exception ex) { 

    }
}

void link_Clicked(object sender, CommandEventArgs e) {
    List<Job> jList = GetJobs(e.CommandArgument.ToString());
    foreach (Job job in jList) {
        HtmlTableRow row = new HtmlTableRow();
        AddCell(job.JobID.ToString(), job.Name, row);
        jobsTable.Rows.Add(row);
    }
} 


void AddCell(string id, string text, HtmlTableRow row) {
    HtmlTableCell cell = new HtmlTableCell();
    LinkButton link = new LinkButton();
    link.ID = id;
    link.Text = text;
    link.Command += new CommandEventHandler(job_Command);
    link.CommandArgument = id;
    link.Style.Add("color", "black");
    cell.Controls.Add(link);
    row.Cells.Add(cell);
}

void AddLinkButton(string id, string text, HtmlGenericControl list, CommandEventHandler handler) {
        LinkButton link = new LinkButton();
        link.ID = id;
        link.Text = text;
        link.Command += new CommandEventHandler(handler);
        link.CommandArgument = id;
        HtmlGenericControl li = new HtmlGenericControl("li");
        li.Controls.Add(link);
        list.Controls.Add(li);
    }

Above in the Page_Load event I am creating the list of users. When a user is clicked it is firing link_Clicked. link_Clicked then creates a list of rows pertaining to that User, so activity or job links.

My problem is that I need to determine in Page_Load whether or not one of the links created in link_Clicked was actually clicked. If anyone has better suggestions to the way that I am doing this I am definitely all ears. I am very new to asp.net development so there is probably a better route to go for this.

  • 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-07T11:09:50+00:00Added an answer on June 7, 2026 at 11:09 am

    Got it!

    string test1234 = Page.Request.Params.Get("__EVENTTARGET");
    

    That passes me back the ID of the control which is exactly what I needed.

    I found a tutorial here.

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

Sidebar

Related Questions

I have a linkbutton inside a listbox that receives a list of objects. I'm
I have a GridView that shows a list of users. Each user has a
I have list of articles on the page in table and i want to
i have list of rows that user select and i want to delete them,
in an asp.net page I have a list of Link buttons: <asp:LinkButton ID=LinkButton1 runat=server
I created LinkButton that located inside of Repeater Control. CategoryID is a variable in
I have a list with button links when a button list is clicked this
I have a Gridview that shows a list of Contacts via a sqlDataSource. Included
i have a question about asp : i have a list of ids that
I have a Repeater with a list of Customers. Against each customer there is

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.