I'm trying to get my DataGrid to show headers and footers when no rows are
returned from the datasource. Below is code that shows the first
TemplateField. Is there an easy way to get at least the footer to show? I
want to be able to insert a new row using the footer. Thanks...
<asp:GridView ID="gvMaterials" runat="server"
AutoGenerateColumns="False"
DataSourceID="dsMaterials" ShowFooter="True" Width="100%"
AutoGenerateEditButton="True">
<Columns>
<asp:TemplateField HeaderText="Material:">
<FooterTemplate>
<asp:TextBox ID="txtDescription"
runat="server"></asp:TextBox>
</FooterTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtDescription" runat="server"
Text='<%# Bind("Description") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblDescription" runat="server" Text='<%#
Bind("Description") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
[etc...]
--
My BizTalk blog:
http://stevestechnotes.blogspot.com/
I'm going to go out on a limb and guess that it is an ArrayList?
To get metadata, it needs some clue to the data. There are various
ways it can do this - the simplest is a typed indexer - i.e. a "public
T this[int index] {get;}" for some T (doesn't have to be generics...).
In the absense of a typed indexer, the metadata of the first item is
used. If there aren't any items, you're scuppered.
(there are also things like ITypedList and IListSource that are taken
into account, but these are more complex)
If you aren't using ArrayList, then tell us what you *are* using as
the data-source.
Marc
Thanks,
Steve
"Marc Gravell" <marc.g...@gmail.com> wrote in message
news:decd1a39-6c12-4a55...@x35g2000hsb.googlegroups.com...
Marc
Gridview does not display anything if database is returning zero number of rows.
In case you still want to display it then you can enter some dummy rows in an arraylist or dataset and then connect it to gridview and then hide that dummy row in grid , it will display only header and footer now.
- Steve
<Sunil Lakshkar> wrote in message news:20085191302...@gmail.com...