Home All Groups Group Topic Archive Search About

DataGrid1.DataSource = ds.Tables(2)

Author
14 Mar 2006 2:56 PM
Xavier
hello,

i get in a dataset returned 3 Tables
I want to display in a templated column the values of the table nr 3.

DataGrid1.DataSource = ds.Tables(2)

In a datagrid if i let AutoGenerateColumns=True all works ok.
For example i get 3 rows displayed with the column names

ID Title Modified Created  Body

What is the syntax if i want to have only over a templated column the columns
Title and  Body

I tryed something like

<%# DataBinder.Eval(Container.DataItem,  "Title") %>

but it did not work

thanks

Author
14 Mar 2006 4:23 PM
Phillip Williams
<asp:TemplateColumn HeaderText ="Title">
    <ItemTemplate>
        <asp:Label ID="lblTitle" Runat=server
        Text='<%# DataBinder.Eval(Container.DataItem, "PersonName")%>'>
        </asp:Label>
    </ItemTemplate>
    <EditItemTemplate>
        <asp:TextBox ID="txtTitle"  Runat=server
            Text='<%#DataBinder.Eval(Container.DataItem, "Title") %>'></asp:TextBox>
    </EditItemTemplate>
</asp:TemplateColumn>

Show quoteHide quote
"Xavier" wrote:

> hello,
>
> i get in a dataset returned 3 Tables
> I want to display in a templated column the values of the table nr 3.
>
> DataGrid1.DataSource = ds.Tables(2)
>
> In a datagrid if i let AutoGenerateColumns=True all works ok.
> For example i get 3 rows displayed with the column names
>
> ID Title Modified Created  Body
>
> What is the syntax if i want to have only over a templated column the columns
> Title and  Body
>
> I tryed something like
>
> <%# DataBinder.Eval(Container.DataItem,  "Title") %>
>
> but it did not work
>
> thanks
>
>