Hi
I am using asp.net mvc and I am not sure how to approach this problem. I have a table in my database and that has some fields in it.
I want to generate a table with this. So I first tried to make a html helper that would make the table and and all the stuff I need but I am finding it too hard to maintain and causing problem for the designers who would actually like to see the table so they can add something different to each row or column if they want.
Right now if they need something I have to go add it in the html helper for them. So its just not working and better to stick to a html table that uses scaffolding.
Now my problem is 2 of the columns in this database table are used for styling.
Like I might have this table
<table>
<tr> <td style="font-color : color;> hi </td> </tr>
</table>
So see the actual color for font-color would be grabbed from that database. It is possible each row could have a different color.
So I am not sure how to set this nicely.
Like I could do something like this since I am using scaffolding
<table>
<tr> <td style="font-color: <%= item.color %>> hi </td> </tr>
</table>
This just looks horrible(spaghetti code) and I think there should be another way.
So then I thought maybe I should make a html helper for table cells. But I am not sure how to do it.
at first I did something like this Html.TableCell("test","a");
first param is "id" and second is the "innertext" of the td.
But then I thought what happens if this is a super long text that will look so stupid and messy.
So then I thought maybe do what the begin form does that you can put it in a using statement or something but I don't know how to make a html helper that can use a using statement.
I am just so lost of how to best make this that will look nice and still will look like a table.
Thanks