navinbabu
asked on
How to force a datagrid to display with no data
Hello guys ,
I have a datagrid with autogenerate = false . which is populated based on the previous datagrid . Now , in the second grid I have a text box and insert command to insert in to the grid . But I want to show the grid even its empty so that I can use the insert functionality to add new records
Thanks
I have a datagrid with autogenerate = false . which is populated based on the previous datagrid . Now , in the second grid I have a text box and insert command to insert in to the grid . But I want to show the grid even its empty so that I can use the insert functionality to add new records
Thanks
http://blogs.claritycon.com/blogs/kevin_marshall/archive/2006/02/28/247.aspx
Also you can use EmptyDataTemplate, like this:
<asp:GridView ID="GridView1" runat="server">
<EmptyDataTemplate>
There is no data.
</EmptyDataTemplate>
</asp:GridView>
<asp:GridView ID="GridView1" runat="server">
<EmptyDataTemplate>
There is no data.
</EmptyDataTemplate>
</asp:GridView>
ASKER
Hello reza_rad ,
thanks but can I make it visible only up on the first grid index selection
thanks but can I make it visible only up on the first grid index selection
The GridView has ShowHeaderWhenEmpty property.
Set it to true, to show only the headers
Set it to true, to show only the headers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Reza rad .
here is a screen shot
http://img237.imageshack.us/img237/3055/69420553.png
the status and remarks grid are populated up on the selecting in the first grid . Now in the remarks grid we have add option right .
I want that to be displayed even when the remarks grid is empty so that users can add one remarks
I hope I'm clear
here is a screen shot
http://img237.imageshack.us/img237/3055/69420553.png
the status and remarks grid are populated up on the selecting in the first grid . Now in the remarks grid we have add option right .
I want that to be displayed even when the remarks grid is empty so that users can add one remarks
I hope I'm clear
could you upload you image here?
I can not see the link you referred
I can not see the link you referred
ASKER
Reza red I m attaching the image
69420553.png
69420553.png
try like this:
use EmptyDataTemplate like this:
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSourc e1">
<EmptyDataTemplate>
Empty table. click on this button to insert new record
<asp:Button ID="Button1" runat="server" Text="Add" onclick="Button1_Click" />
</EmptyDataTemplate>
</asp:GridView>
use EmptyDataTemplate like this:
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSourc
<EmptyDataTemplate>
Empty table. click on this button to insert new record
<asp:Button ID="Button1" runat="server" Text="Add" onclick="Button1_Click" />
</EmptyDataTemplate>
</asp:GridView>
ASKER
when we use emptydata template it is displayed even before its populated as I said this is populated based up on the selection on first grid .
use emptydatatemplate with combination of first grid selectionIndexchanged event as i said in this post: 26769825
does it make sense to you?
if not, upload your code here
does it make sense to you?
if not, upload your code here