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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:20:36+00:00 2026-05-27T04:20:36+00:00

This is application i am doing in c# web application I am creating link

  • 0

This is application i am doing in c# web application
I am creating link buttons dynamically as below.

for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {         
                LinkButton ln = new LinkButton();
                ln.Text = ds.Tables[0].Rows[i].ItemArray[0].ToString();
                ln.ID =  ds.Tables[0].Rows[i].ItemArray[1].ToString();  
                divonlne.Controls.Add(ln);
                divonlne.Controls.Add(new LiteralControl("<br/>"));
            }

my click event is as follows

 ln.Click += new EventHandler(Clicked);

In my click event i am getting the linkbutton text and Id as follows

   protected void Clicked(object sender, EventArgs e)
        {
            LinkButton lno = sender as LinkButton;
            Session["Toname"] = lno.Text;
            Session["idto"] = lno.ID;
        }

But this is firing only when the last link button is clicked.
Can anyone help me out?

  • 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-27T04:20:36+00:00Added an answer on May 27, 2026 at 4:20 am

    You already wrote how you subscribe the Click Event, but in your sample i cant see it.
    Maybe you subscribe on the wrong place. This works…

    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {         
        LinkButton ln = new LinkButton();
        ln.Text = ds.Tables[0].Rows[i].ItemArray[0].ToString();
        ln.ID =  ds.Tables[0].Rows[i].ItemArray[1].ToString();  
        ln.Click += new EventHandler(Clicked);
        divonlne.Controls.Add(ln);
        divonlne.Controls.Add(new LiteralControl("<br/>"));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a web application and will be doing my own testing anyway to
I've been creating this pretty large web application for sometime and have been updating
I'm doing an asp.net application with one page. In this page, I have one
I have a WCF service application and in this app I am doing calls
My application links against libsamplerate.a. I am doing this to make distributing the final
I don't know what's the best way to doing this. On my application.html.erb I
We need to represent huge numbers in our application. We're doing this using integer
I am currently responsible for creating a web based project management application for the
I've got an ASP.NET application that I installed by creating a web setup. I
In a Java web application I am creating a zip file from various in-memory

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.