Okay, I spent about 3 hours getting the GridView control to do what I
needed.
Basically, I set the control's AutoGenerateCol umns to False and then defined
a single template column (which I will customize with my own content). This
looks something like this:
<asp:GridView ID="GridView1" runat="server" CellPadding="4"
ForeColor="#333 333" GridLines="None " AutoGenerateCol umns="False"
Width="100%" AllowPaging="Fa lse"
OnPageIndexChan ged="GridView1_ PageIndexChange d">
<Columns>
<asp:TemplateFi eld HeaderText="Art icles">
<ItemTemplate >
<b><%# Eval("art_name" ) %></b><br />
<%# Eval("art_desc" ) %>
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>
</asp:GridView>
Then, in my page's Load event, I run a database query and do something like
this:
SqlDataReader reader = cmd.ExecuteRead er();
GridView1.DataS ource = reader;
GridView1.DataB ind();
reader.Close();
I finally got it working. However, when I set the AllowPaging property to
True, then the grid displays absolutely nothing on the Web page. (It looks
fine in the IDE.)
I even tried running a new query and re-executing the lines above in
response to the control's PageIndexChange d event but that doesn't help.
Does anyone have any ideas?
Thanks!
--
Jonathan Wood
SoftCircuits Programming
needed.
Basically, I set the control's AutoGenerateCol umns to False and then defined
a single template column (which I will customize with my own content). This
looks something like this:
<asp:GridView ID="GridView1" runat="server" CellPadding="4"
ForeColor="#333 333" GridLines="None " AutoGenerateCol umns="False"
Width="100%" AllowPaging="Fa lse"
OnPageIndexChan ged="GridView1_ PageIndexChange d">
<Columns>
<asp:TemplateFi eld HeaderText="Art icles">
<ItemTemplate >
<b><%# Eval("art_name" ) %></b><br />
<%# Eval("art_desc" ) %>
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>
</asp:GridView>
Then, in my page's Load event, I run a database query and do something like
this:
SqlDataReader reader = cmd.ExecuteRead er();
GridView1.DataS ource = reader;
GridView1.DataB ind();
reader.Close();
I finally got it working. However, when I set the AllowPaging property to
True, then the grid displays absolutely nothing on the Web page. (It looks
fine in the IDE.)
I even tried running a new query and re-executing the lines above in
response to the control's PageIndexChange d event but that doesn't help.
Does anyone have any ideas?
Thanks!
--
Jonathan Wood
SoftCircuits Programming
Comment