473,884 Members | 2,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET C# Table and Buttons

4 New Member
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);
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?


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:43 px;" />[/HTML]
and then after i clicked it once...
[HTML]<input type="submit" name="ctl05" value="Edit" style="Width:43 px;" />[/HTML]
then when i click that one, it called the edit_Click()
Aug 7 '07 #1
1 8924
4 New Member
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

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"> <input type="Submit" name="submit" value="Patientenkartei" width="350">
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 Classes Table? YES NO Upon clicking on yes, then all the records in the classes table would be deleted.
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 array and assign images in code, much easier with a class module - but unfortunately Access does not support control arrays).
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 to well as I got an error trying to put rows collection in the viewstate. My problem is this: I load a table with rows and controls, then wire events, this is after clearing the rows of the table initially in this function.
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 buttons in web form. Since those radio buttons and textboxes and text would overlap each other, when a client user use large size in his web browser. Stas's suggestion is to use table. I insert a panel into the design pane and then a table into the...
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 top right table cell. These elements should stay on one line and the table should keep a minimum width in order to prevent wrapping. -------------------------------------------------
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 following data. Firstly, I have a main table which records the specifics of the intervention (date, reporter, details, location etc). It has links and the database is normalised ok as far as I can make out. However, I have 6 check box fields in...
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 the pop up window .
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 I have the grid of 1-5 questions and radio button answers layed out in a table. I couldn't find a tutorial for a css grid, so I hacked it for now. Ideally, I would like to have the question layout in css.
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 access pages) for my user interface, but I'm not sure that the method will be much different than forms (except for some of the property names). I think my understanding or background knowledge on the subject is just lacking. I have an option...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.