Hey Rob,
Try one of the following two:
1. (In a C# code behind for the button click event)
System.Web.UI.WebControls.TableRow tr = new
System.Web.UI.WebControls.TableRow();
System.Web.UI.WebControls.TableCell tc = new
System.Web.UI.WebControls.TableCell();
tc.Text = "blah";
tr.Cells.Add(tc);
myTable.Rows.Add(tr); //This assumes you have a asp:table server control
with an id="myTable"
(In the .aspx file)
<asp:Table ID="neat" Runat="server">
<asp:TableRow>
<asp:TableCell>
slick
</asp:TableCell>
</asp:TableRow>
</asp:Table>
2.
[color=blue]
> Dim tRow As New TableRow()
> Table1.Rows.Add(tRow)[/color]
Change this to use explicit declarations like I did above. It appears that
there are two different libraries with two different methods of creating
TableRows, and you HAVE to be consistent with the table type you've created.
Based on your error message, it appears that there are:
a) System.Web.UI.WebControls.TableRow
b) System.Web.UI.HtmlControls.HtmlTableRow
Hope you find this moderately useful. Good luck!
Mark
www.dovetaildatabases.com
"Rob Meade" <robert.meade@NOSPAMubht.swest.nhs.uk> wrote in message
news:usaoNGqsDHA.3224@tk2msftngp13.phx.gbl...[color=blue]
> Hi all,
>
> I'm desperately trying to get this to work and I just cant do it - new to
> ASP.net - probably the reason!
>
> I'm using visual studio for this - I have this in the html page :
>
> <asp:Table id="Table1" runat="server"></asp:Table>
>
> there is other code too but I believe this to be the relevant part...
>
> In my button on click event I am trying to do this :
>
> Dim tRow As New TableRow()
> Table1.Rows.Add(tRow)
>
> which I have copied EXACTLY from the visual studio help and MS site (both
> examples the same etc)..
>
> 2 problems..
>
> 1: The brackets get removed from the first line
> 2: the tRow within the brackets gets underlined and has the following[/color]
error[color=blue]
> :
>
> Value of type 'System.Web.UI.WebControls.TableRow' cannot be converted to
> 'System.Web.UI.HtmlControls.HtmlTableRow'.
>
> I have no idea what the problems is or how to fix it - however I do[/color]
suspect[color=blue]
> the item 2 is a direct result of the missing brackets in item 1 - and that
> these are probably missing because I've not done some form of 'IMPORT' at
> the top of the page???
>
> But to be honest I have no real clue....
>
> If someone could suggest a reason / way forward I would be most grateful.
>
> Regards
>
> Rob
>
>
>
>[/color]