R
Richard Dixson
I created a new C# web application. Basically all I am trying to do is
create a table that consists of a few rows with two columns in each. And
then to set those columns to text values from my code behind. However I am
not able to do this at all, I am going about this wrong, I think and need
guideance.
If this was just straight HTML I would do this:
<table>
<tr><td>field 1</td><td>value 1 set by code behind</td></tr>
<tr><td>field 2</td><td>value 2 set by code behind</td></tr>
</table>
I dragged a Table object from the Webform control box onto my page. Then I
used the "..." in the properties to create some rows and columns.
But what I cannot figure out is how to set the columns from my code behind
page to text values I want displayed. I can't even figure out how to
reference the columns. I could reference the Table object from code behind,
but wasn't sure how to get at the rows or columns. Do I need to create text
label objects inside the column objects? How am I supposed to access these
columns via code behind?
I searched around and all I found was indepth info on data grid table
display. But this should be much simplier. I'm just trying to create a
static table (do not need to create rows/columns on the fly) that I can set
the columns to values at run time from code behind.
Also I would like to add that I would like these labels inside the table
cells that I set via the code behind to persist. Is that possible?
For example then first time the page is run (via a GET) I want to display
the table and set the column value labels from my code behind page.
Then after the table I will have a short form that the visitor can fill how
and then press the Submit button.
When the submit button is pressed and the page is resubmitted to itself,
this time via the POST, I would like ASP.NET to AUTOMATICALLY pick up the
same labels inside my table that I set via the GET request. Will that
happen automatically, or will the values fall back to their defaults?
Remember for these values they are in a table column label and not in a web
form.
Can someone please advise? A tiny code sample would help best. Thanks!
Richard
create a table that consists of a few rows with two columns in each. And
then to set those columns to text values from my code behind. However I am
not able to do this at all, I am going about this wrong, I think and need
guideance.
If this was just straight HTML I would do this:
<table>
<tr><td>field 1</td><td>value 1 set by code behind</td></tr>
<tr><td>field 2</td><td>value 2 set by code behind</td></tr>
</table>
I dragged a Table object from the Webform control box onto my page. Then I
used the "..." in the properties to create some rows and columns.
But what I cannot figure out is how to set the columns from my code behind
page to text values I want displayed. I can't even figure out how to
reference the columns. I could reference the Table object from code behind,
but wasn't sure how to get at the rows or columns. Do I need to create text
label objects inside the column objects? How am I supposed to access these
columns via code behind?
I searched around and all I found was indepth info on data grid table
display. But this should be much simplier. I'm just trying to create a
static table (do not need to create rows/columns on the fly) that I can set
the columns to values at run time from code behind.
Also I would like to add that I would like these labels inside the table
cells that I set via the code behind to persist. Is that possible?
For example then first time the page is run (via a GET) I want to display
the table and set the column value labels from my code behind page.
Then after the table I will have a short form that the visitor can fill how
and then press the Submit button.
When the submit button is pressed and the page is resubmitted to itself,
this time via the POST, I would like ASP.NET to AUTOMATICALLY pick up the
same labels inside my table that I set via the GET request. Will that
happen automatically, or will the values fall back to their defaults?
Remember for these values they are in a table column label and not in a web
form.
Can someone please advise? A tiny code sample would help best. Thanks!
Richard