Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello sir.
I have a gridview and some boundfields.
I want to display the gridview whenever I open the page. How can I do that? If any body knows please help me.
Thank you.
XML
<asp:GridView ID="GVProductOrder" runat="server" AutoGenerateColumns="false"
                                                GridLines="Vertical" Height="200" Width="1050">
                                                <HeaderStyle CssClass="HeaderStyleGrid" />
                                                <Columns>
                                                    <asp:BoundField DataField="ItemCode" HeaderText="Item Code" />
                                                    <asp:BoundField DataField="ItemName" HeaderText="Item Name" />
                                                    <asp:BoundField DataField="Cost" HeaderText="Cost" />
                                                    <asp:BoundField DataField="MRP" HeaderText="MRP" />
                                                    <asp:BoundField DataField="SP" HeaderText="SP" />
                                                    <asp:BoundField DataField="MBQ" HeaderText="MBQ" />
                                                    <asp:BoundField DataField="Quantity" HeaderText="Quantity" />
                                                    <asp:BoundField DataField="FreeQty" HeaderText="Free Qty" />
                                                    <asp:BoundField DataField="FixedDisc" HeaderText="Fixed Disc" />
                                                    <asp:BoundField DataField="Tax" HeaderText="Tax" />
                                                    <asp:BoundField DataField="Value" HeaderText="Value" />
                                                    <asp:BoundField DataField="OnOrder" HeaderText="On Order" />
                                                    <asp:BoundField DataField="Remarks" HeaderText="Remarks" />
                                                    <asp:BoundField DataField="Type" HeaderText="Type" />
                                                    <asp:BoundField DataField="EanCode" HeaderText="Ean Code" />
                                                </Columns>
                                            </asp:GridView>
Posted
Updated 22-Nov-10 19:55pm
v2

If you are not binding data on page load, you can use empty data template to report users as no data in gridview.....
just add..
XML
<EmptyDataTemplate>
             No Data !
         </EmptyDataTemplate>
 
Share this answer
 
Well, place your code of data fetch & data binding in your page load!
Gridview will be displayed whenever you open page.
 
Share this answer
 
write a query like this ..

SQL
SELECT ItemID,ItemName FROM TableName
UNION ALL
SELECT 0,'' FROM TableName HAVING COUNT(*)=0 ";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900