473,320 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Adding dynamic LinkButton to dynamic table

I have scoured the web to no avail. Any post that resembles my problem has no
answer.

I have an asp table on my page. I add rows and cells to it at run time with
info provided from a database in a custom function. To one of those cells I
add a new LinkButton, then wire a command event handler to it, which calls
the custom function, thus bypassing any need to use IsPostBack.

When a user clicks on the link button, nothing happens. I ran it through
debug with breaks, and it doesn't even go through the event handler.

So I tried a brand new blank page, and put a single linkbutton on it with an
event handler and some test values. What I found disturbed me. The command
and argument values are not stored in the resulting html! I'm at a loss to
explain how a linkbutton works, but I feel this discovery is key to why mine
aren't working.

Anyone know why this happens? I'd really how linkbuttons work internally, so
that I can better plan solutions. Am I simply doing something wrong?

code:

private void create_table()
{
r = new TableRow();
c = new TableCell();
LinkButton lb = new LinkButton();
lb.ID = "lb_" + user_id;
lb.Text = user_company_name;
lb.CommandName = "SHOW_USER_DETAILS";
lb.CommandArgument = user_id;
lb.Command += new
System.Web.UI.WebControls.CommandEventHandler(this .lb_show_user_details_Command);
c.Controls.Add(lb);
r.Cells.Add(c);
table1.Rows.Add(r);
}
Nov 19 '05 #1
0 1530

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sue | last post by:
On code-behind page: (attributes set programatically for each of these elements) linkbutton added to tablecell textbox added to tablecell tablecells added to tablerow tablerow added to table...
4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
1
by: hybrid | last post by:
I have problems in understanding the behavior of the events triggered by dynamically created controls over a webform. Could you help me? In a webform, I have a static PlaceHolder PH containing...
5
by: Patrick | last post by:
Hello I have the following problem. I have an aspx Page. This page contains an ASP-Table Object. So in that table, I have a linkbutton. So, I can't edit the event of that button trough the...
0
by: RSB | last post by:
Hi Every one, i am trying to create a UserControl and i am passing a Array of strings to it. Now based on the Array elements i am creating the LinkButtons Dynamically. I am also passing a Event to...
4
by: Mike Lowery | last post by:
I have an ASP.Net page that simply generates a dynamic page using Response.Write() statements to generate the HTML. This works great except that one of the things I want to generate is a...
1
by: Jack | last post by:
Hi, I am new to .NET and need help with adding click event on LinkButton programatically. Please see the code below. I would like to add a click event on LinkButton returned from "Function...
1
by: SunshineInTheRain | last post by:
The following code is dynamic create dropdownmenu which data within pulled from database However, the code work well on IE but not on Firefox. On Firefox, the whole mouseover and mouseout function...
7
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm adding subheadings to a gridview. Each sub head has a few link buttons. I'm adding the controls in the rowdatabound event code follows: sorry about the length here. I have to be missing...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.