Oh boy - overthinking it, or just plain dumb...

college_amy

Regular
Joined
Jan 3, 2004
Messages
83
Alright, I need to create a table (did it) that will have rows and cells (duh), and I need it to have a button in one cell that says add(did it).. this is all in an asp:table . When the button is clicked (having trouble referencing it since it is in the table, some reason VS won't recognize it, so I must be doing something wrong.. and I can't double click it to get it to recognize it itself - clicking on it highlights the entire table) have it add a new row with 7 cells and all the same controls as in the first row.
Then I need to be able to get data from each of those textboxes (3), dropdownlists (1), radiobuttonlists (2), and a button that says add or I can reference the add button before or something... so I can add the data to a database.

Problem is, I don't know how to do it.
Oh - i am using C#.
searched web 100 times... nothing to do exactly what I need it to... or for the most part, anything close. Searched here... couldn't find my solution either...
ANY help is greatly appreciated.
Amy
 
A table cell is a naming container; to wire an event you need to manually make the event with the proper delegate in your code behind - it won't automagically wire up for you because the control is not a part of the Form control collection, it's is a part of the Cell control collection which is a part of the Row control collection which is a part of the Table control collection - only events of the table control itself could be wired up in the desiger - you need to have code like the following:

C#:
protected void tableButton1_OnClick(object sender, EventArgs e)
{
     //code
}

Or if you prefer VB:

Visual Basic:
Protected Sub tableButton1_OnClick(ByVal sender As Object, ByVal e As EventArgs)
      'Code
End Sub

Then in the html code your button would have:

Code:
<asp:Button id="tableButton1" runat="server" OnClick="tableButton1_OnClick"></asp:Button>

There are of coarse otherways to do it, but this, in my opinion, is the easiest to trace and understand.
 
Thanks... forgot about the whole OnClick thing... geesh, guess it falls into the "just plain dumb" category... LOL
 
Back
Top