GridView disapears after selecting Edit

G

Guest

Hi Everyone,
I have a gridview control with the following markup:
<asp:GridView ID="grdPOs" runat="server" AllowPaging="True"
AutoGenerateColumns="False"
BackColor="White" BorderColor="#CC9966" BorderStyle="None"
BorderWidth="1px"
CellPadding="4" DataKeyNames="ItemId" Height="68px" PageSize="5"
Width="642px">
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<Columns>
<asp:BoundField DataField="Page" HeaderText="Page"
SortExpression="Page">
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="CatalogId" HeaderText="Catalog #">
<ItemStyle HorizontalAlign="Right" Width="80px" />
</asp:BoundField>
<asp:BoundField DataField="ItemDescription"
HeaderText="Description" SortExpression="ItemDescription">
<ItemStyle Width="250px" />
</asp:BoundField>
<asp:BoundField DataField="Qty" HeaderText="Qty"
SortExpression="Qty">
<ItemStyle HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="UnitPrice"
DataFormatString="{0:C}" HeaderText="UnitPrice"
SortExpression="UnitPrice">
<ItemStyle HorizontalAlign="Right" Width="70px" />
</asp:BoundField>
<asp:BoundField DataFormatString="{0:0.00}"
HeaderText="Total" InsertVisible="False" />
<asp:CommandField ShowEditButton="True" />
<asp:ButtonField CommandName="Delete" Text="Delete" />
<asp:BoundField DataField="POrderId" HeaderText="POrderId"
InsertVisible="False"
SortExpression="POrderId" Visible="False" />
<asp:BoundField DataField="OrderDate" HeaderText="OrderDate"
SortExpression="OrderDate"
Visible="False" />
<asp:BoundField DataField="ItemID" HeaderText="ItemID"
InsertVisible="False" SortExpression="ItemID"
Visible="False" />
<asp:ButtonField Text="Add" />
<asp:ButtonField Text="Cancel" />
</Columns>
<RowStyle BackColor="White" ForeColor="#330099" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True"
ForeColor="#663399" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099"
HorizontalAlign="Center" />
<HeaderStyle BackColor="#990000" Font-Bold="True"
ForeColor="#FFFFCC" />
</asp:GridView>

The problem, is after clicking "Edit", the grid disapears. Has anyone seen
this. I'm still catching up on ASP.NET so please bear with me. Thanks for any
help.
Mike
 
G

Guest

Hi Michael,

The markup that you posted does not show the method of databinding that you
use. Usually you would have a datasourceid value defined on the GridView
markup, but your code is not showing such a setting.

If you are databidning in the codebehind using a dataset, then you will have
to handle the GridView.RowEditing event to set the EditIndex property and
then re-databind.

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowediting(VS.80).asp
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.editindex(VS.80).aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top