473,508 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView disapears after selecting Edit

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
Apr 13 '06 #1
2 2785
You need to reload your grid in the edit sub
"Michael" <Mi*****@discussions.microsoft.com> wrote in message
news:84**********************************@microsof t.com...
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

Apr 13 '06 #2
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/lib...ng(VS.80).aspx
http://msdn2.microsoft.com/en-us/lib...ex(VS.80).aspx

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Michael" wrote:
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

Apr 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1081
by: Steve | last post by:
When coding in vbscript asp, I did everything from scratch and could control the way that for example my data tables looked and could be edited. I for example could allow the user to delete...
3
13725
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
3
4459
by: Dabbler | last post by:
What is the best way to have a FormView page open on a specific row selected from a GridView? I'm passing the primary key in the url as in detailview.aspx?mode=edit&pk=42 I'm using an...
0
974
by: Rick | last post by:
Has anyone heard about an ASP.NET 2.0 bug with retrieving values on the fly from a GridView control when in Edit mode ? I have a GridView built with an Edit button. When the Edit button is...
0
2161
by: Not Me | last post by:
Hi there, How come, when using default settings on a gridview which has a stored procedure as it's datasource's selectcommand, do I have to sort the stored procedure in order to have the edit...
0
2790
by: Eraser | last post by:
Hi to all .NET guru guys... I have a problem in my delete button inside gridview. How to avoid postback on when i select cancel on confirmation message? But postback is okay on Ok confirmation....
4
9766
by: mohaaron | last post by:
This seems like it should be simple to do but for some reason I have been unable to make it work. I would like to databind a SqlDataSource to a GridView during the click event of a button. This...
2
1410
by: katmagic | last post by:
I have the SelectedValue of a gridview, how do I select the row based on that information?
2
5322
by: Michael | last post by:
It seems that a gridview allows us to delete only a single row at a time. How to extend this functionality to select multiple rows and delete all of the selected rows in a single stroke? just like...
0
7229
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7333
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5637
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
428
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.