|
Subject:
|
Building table rows dynamically
|
|
Posted By:
|
nikotromus
|
Post Date:
|
1/18/2006 8:49:36 PM
|
Howdy,
I am trying to build a table row dynamically from a table that I positioned on a web form. The table name is "MarketTable" Here is the code:
Partial Class Default2 Inherits System.Web.UI.Page
Private WithEvents MarketTable As System.Web.UI.WebControls.Table
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tr As New TableRow MarketTable.Rows.Add(tr) End Sub End Class
When I run the code, I get the following error: Use the "new" keyword to create an object instance.
Any suggestions?
nikotromus
|
|
Reply By:
|
nikotromus
|
Reply Date:
|
1/21/2006 2:00:29 PM
|
I fugured out the problem. My anchor on the web page was not in the proper format. Here is the successful anchor I used. By doing this, it allowed me to access the properties of the table in the code.
<asp:Table ID ="MarketTable" cellpadding="3" cellspacing="3" style="z-index: 102; left: 302px; position: absolute; top: 107px" runat="server"></asp:Table>
Before, I simply creating a table on the page, through the interface tools. That didn't work. This anchor looks like this:
<table id="suckit"> </table>
This is the third straight post I've made on p2p.wrox forums with no reply. I'm starting to get worried about this place. Ryan
nikotromus
|
|
Reply By:
|
rodmcleay
|
Reply Date:
|
1/21/2006 10:10:11 PM
|
Hi nikotromus, I use this forum heaps and have always found the replies to be prompt and very helpful. But there are a couple of things that make it easier for people to reply.
1) Use the forum closest to your needs, in this case I feel you would have had a better response from an ASP.NET forum rather than general .NET . 2) Explain your problem in its entirity, in your case the html for the table would have provided an instant response in the ASP.NET forum, as with any controls on a ASP.NET page they must be identifies as ASP.NET controls and not HTML controls and also must have the runat="server" attribute as you are now aware.
Hope you have better luck next time. Rod
====================================== They say, best men are molded out of faults, And, for the most, become much more the better For being a little bad. ======================================
|