473,387 Members | 1,529 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,387 software developers and data experts.

ASP.NET C# Table and Buttons

This is the strangest bug I have ever seen with ASP.NET. I've got a table that is programaticly made using C#. Everything works fine, i get a table with a list of emails from a database, i click edit and all the Labels turn into TextBoxes on that row where i clicked edit.

Expand|Select|Wrap|Line Numbers
  1.                 TableCell cell5 = new TableCell();
  2.                 Button b = new Button();
  3.                 b.Text = "Save";
  4.                 b.Style.Add("Width", "90px");
  5.                 b.CommandArgument = (i + 1).ToString();
  6.                 b.Click += new EventHandler(save_Click);
  7.                 cell5.Controls.Add(b);
  8.                 row.Cells.Add(cell5);
  9.  
But when I click this save button, it posts back to the server but nothing happens. When i click it again it called save_Click :s

When i click edit it also brings up a few new rows for the alias of the email account i just clicked. When i click delete next to the aliases it sometimes deletes (but i have to click it twice again), sometimes it deletes the wrong one. Sometimes it adds a new one with a username of the disk quote for that email account eg. 6@domain.com

The function that makes the table is in the page_Load() because if i put it anywhere else, it deletes the table every time I post back to the server :s

Anyone came across this before or know how to fix any of these problems?

Edit:

i read the html source of the table, when i load the page, values of the edit button
[HTML]<input type="submit" name="ctl17" value="Edit" style="Width:43px;" />[/HTML]
and then after i clicked it once...
[HTML]<input type="submit" name="ctl05" value="Edit" style="Width:43px;" />[/HTML]
then when i click that one, it called the edit_Click()
Aug 7 '07 #1
1 8906
Okay i fixed it now -_-
I added

Expand|Select|Wrap|Line Numbers
  1. b.ID = "edit" + i.ToString();
and the server obviously knew which button it was pressing after i gave it an ID :D
Aug 7 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Werner Partner | last post by:
I made a little menue system (by php) and now have some problems with html. It looks like that: <table border> <tr><td width=350><form action="pkartei.php" style="margin: 0" method="post">...
1
by: Jeffro | last post by:
Hi, I am trying to create a form that would have only two buttons on it. When the user clicks on one of the buttons it will issue a prompt such as Do you wish to delete all records from the...
5
by: Axel | last post by:
An Access 2000 question Hi is is possible to have (as a subform) a continous form with 0..n buttons which have different images in each row. (Personally I would have preferred a button...
8
by: John Smith Jr. | last post by:
I am looking for some way to persist a table web control so when page_load event comes up, i can display the table as it was. I tried using ViewState with the rows collection but that didn't work...
0
by: david | last post by:
Yesterday I got a suggestion about the web page layout from Stas. Thanks, Stas. However, I have a problem to drag the existing radio buttons into the table cell. Case: I have a lot of radion...
7
by: Daniel Kabs | last post by:
Hi there, for a long time I've been using tables to layout elements on a web page. Example: Say we have a 2x2 table and I'd like to put text (left aligned) and buttons (right aligned) in the...
3
by: Macbane | last post by:
Hello All, This has been bugging me for too long. I have a database that records medical interventions. I am familiar with the theory behind normalisation but am unsure what to do with the...
1
by: vp.softverm | last post by:
hi all . Am facing problem with the date picker. when i click on date picker in a popup window. the date table is opened in the middle of the pop up window. and it is unable to scroll with...
7
by: lawpoop | last post by:
On Mar 11, 6:58 pm, Bergamot <berga...@visi.comwrote: Berg, thanks for taking the time to look at this. Here is the URL ( sorry for the delay in response): http://nerdcraft.net/survey.html ...
1
beacon
by: beacon | last post by:
Hi everybody, I've searched around for answers, but the closest thing I've found referenced the Northwind database and it seems to be set up a little differently than mine. I'm using DAPs (data...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.