views:

37

answers:

1

Hi everybody, I'm have a bit trouble with grid view. I have a gridview like below:

<asp:GridView ID="gvPageList" runat="server" AutoGenerateColumns="False" 
        AllowPaging="True" onpageindexchanging="gvPageList_PageIndexChanging" 
        PageSize="2">
        <Columns>
            <asp:BoundField DataField="title" HeaderText="Title" ReadOnly="True" 
                SortExpression="title" />

            <asp:TemplateField HeaderText="Creator" SortExpression="creator">
                <ItemTemplate>
                    <%# ((ws.models.Page)DataBinder.GetDataItem(Container)).Creator.UserName %>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

With column #1 i can code to do the same work like using asp.net tag like this:

    BoundField bc = new BoundField();
    bc.DataField = "title";
    bc.HeaderText = "Title";
    gridview.Columns.Add(bc);

And with column #2 how the code look like :D?

A: 

Seems like this and this tutorials might be of your interest.

JohnIdol