Assigning Datasource to a region

Posted by minal on Stack Overflow See other posts from Stack Overflow or by minal
Published on 2009-02-20T04:29:14Z Indexed on 2010/05/30 15:12 UTC
Read the original article Hit count: 297

Filed under:
|
|
|

Hi,

I was wondering if there is an existing control that I could use to achieve what I am trying.

Basically, I have a html table that I display my header information.

It looks something like this:

<table class="tableEdit">
    <tr>
        <th>Job ID</th><td>10</td>
        <th>Client</th><td>Tom</td>
    </tr>
    <tr>
        <th>Comments</th><td>Comments are here</td>
    </tr>
</table>  

I am wondering if there is an existing control that I can use as a container. Then I can assign the datasource to that control and leverage the field values as such.

<asp:Somecontrol runat="server" ID="someid">

<table class="tableEdit">
    <tr>
        <th>Job ID</th><td><%# Eval("Id") %></td>
        <th>Client</th><td><%# Eval("Client.Name") %></td>
    </tr>
    <tr>
        <th>Comments</th><td><%# Eval("Comments") %></td>
    </tr>
</table> 

</asp:Somecontrol>

private void BindHeader()
{
 SomeObjectType data = DAL.SomeMethod();
 someid.Datasource = data;
 someid.DataBind();
}

Is there anything out there to do this? I want to be able to control the layout of the fields within the container.

Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET