473,776 Members | 1,503 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView Update Button Not Displayed

Hi,

My GridView is bound to a DataTable and the GridView properties are set
as follows:
AutoGenerateCol umns="true"
AutoGenerateEdi tButton="true"
AutoGenerateDel eteButton="true "

The Edit and Detete button are displayed but when the Edit button is
clicked, the Update/Cancel buttons are not displayed. Does anyone have any
ideas? The full GridView properties are below.

Thank you,

Scott

<asp:GridView ID="GenericTabl eMaintenanceGri dView"
AutoGenerateCol umns="true"
AutoGenerateEdi tButton="true"
AutoGenerateDel eteButton="true "
AutoGenerateSel ectButton="fals e"
CellPadding="5"
CellSpacing="5"
runat="server">
<FooterStyle BackColor="#FFF FFF" ForeColor="#FFF FFF" />
<RowStyle BackColor="#E7E 7FF" ForeColor="#4A3 C8C" />
<SelectedRowSty le BackColor="#738 A9C" ForeColor="#F7F 7F7" Wrap="false" />
<PagerStyle BackColor="#E7E 7FF" ForeColor="#4A3 C8C"
HorizontalAlign ="Right" />
<HeaderStyle BackColor="#4A3 C8C" Font-Bold="True" ForeColor="#F7F 7F7" />
<AlternatingRow Style BackColor="#F7F 7F7" />
</asp:GridView>
May 3 '07 #1
3 6935
On May 3, 5:11 pm, slemen <sle...@discuss ions.microsoft. comwrote:
Hi,

My GridView is bound to a DataTable and the GridView properties are set
as follows:
AutoGenerateCol umns="true"
AutoGenerateEdi tButton="true"
AutoGenerateDel eteButton="true "

The Edit and Detete button are displayed but when the Edit button is
clicked, the Update/Cancel buttons are not displayed. Does anyone have any
ideas? The full GridView properties are below.

Thank you,

Scott

<asp:GridView ID="GenericTabl eMaintenanceGri dView"
AutoGenerateCol umns="true"
AutoGenerateEdi tButton="true"
AutoGenerateDel eteButton="true "
AutoGenerateSel ectButton="fals e"
CellPadding="5"
CellSpacing="5"
runat="server">
<FooterStyle BackColor="#FFF FFF" ForeColor="#FFF FFF" />
<RowStyle BackColor="#E7E 7FF" ForeColor="#4A3 C8C" />
<SelectedRowSty le BackColor="#738 A9C" ForeColor="#F7F 7F7" Wrap="false" />
<PagerStyle BackColor="#E7E 7FF" ForeColor="#4A3 C8C"
HorizontalAlign ="Right" />
<HeaderStyle BackColor="#4A3 C8C" Font-Bold="True" ForeColor="#F7F 7F7" />
<AlternatingRow Style BackColor="#F7F 7F7" />
</asp:GridView>
It will not work without a data source control (such as a
SqlDataSource control).

To make it working, create a SqlDataSource

<asp:sqldatasou rce id="myDS"
selectcommand=" ..."
updatecommand=" ..."
connectionstrin g="..."
runat="server">
</asp:sqldatasour ce>

and assign it to the data grid

<asp:gridview id="GenericTabl eMaintenanceGri dView"
datasourceid="m yDS"

Hope it helps
May 4 '07 #2
On May 4, 12:06 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 3, 5:11 pm, slemen <sle...@discuss ions.microsoft. comwrote:


Hi,
My GridView is bound to a DataTable and the GridView properties are set
as follows:
AutoGenerateCol umns="true"
AutoGenerateEdi tButton="true"
AutoGenerateDel eteButton="true "
The Edit and Detete button are displayed but when the Edit button is
clicked, the Update/Cancel buttons are not displayed. Does anyone have any
ideas? The full GridView properties are below.
Thank you,
Scott
<asp:GridView ID="GenericTabl eMaintenanceGri dView"
AutoGenerateCol umns="true"
AutoGenerateEdi tButton="true"
AutoGenerateDel eteButton="true "
AutoGenerateSel ectButton="fals e"
CellPadding="5"
CellSpacing="5"
runat="server">
<FooterStyle BackColor="#FFF FFF" ForeColor="#FFF FFF" />
<RowStyle BackColor="#E7E 7FF" ForeColor="#4A3 C8C" />
<SelectedRowSty le BackColor="#738 A9C" ForeColor="#F7F 7F7" Wrap="false" />
<PagerStyle BackColor="#E7E 7FF" ForeColor="#4A3 C8C"
HorizontalAlign ="Right" />
<HeaderStyle BackColor="#4A3 C8C" Font-Bold="True" ForeColor="#F7F 7F7" />
<AlternatingRow Style BackColor="#F7F 7F7" />
</asp:GridView>

It will not work without a data source control (such as a
SqlDataSource control).

To make it working, create a SqlDataSource

<asp:sqldatasou rce id="myDS"
selectcommand=" ..."
updatecommand=" ..."
connectionstrin g="..."
runat="server">
</asp:sqldatasour ce>

and assign it to the data grid

<asp:gridview id="GenericTabl eMaintenanceGri dView"
datasourceid="m yDS"

Hope it helps- Hide quoted text -

- Show quoted text -
you can also use the data binding in the code-behind. In this case you
should use the OnEditCommand and the EditItemIndex property

here's some example (taken from a datagrid control)

<asp:gridview ...
OnEditCommand=" DataGrid1_Edit"
OnCancelCommand ="DataGrid1_Can cel"
OnUpdateCommand ="DataGrid1_Upd ate"
....

Public Sub DataGrid1_Edit( ByVal sender As Object, ByVal e As
DataGridCommand EventArgs)
DataGrid1.EditI temIndex = E.Item.ItemInde x
DataGrid1.DataS ource = ...
DataGrid1.DataB ind()
End Sub


May 4 '07 #3
Thank you, Alexey. Your suggestion worked.

Scott

"Alexey Smirnov" wrote:
On May 4, 12:06 pm, Alexey Smirnov <alexey.smir... @gmail.comwrote :
On May 3, 5:11 pm, slemen <sle...@discuss ions.microsoft. comwrote:


Hi,
My GridView is bound to a DataTable and the GridView properties are set
as follows:
AutoGenerateCol umns="true"
AutoGenerateEdi tButton="true"
AutoGenerateDel eteButton="true "
The Edit and Detete button are displayed but when the Edit button is
clicked, the Update/Cancel buttons are not displayed. Does anyone have any
ideas? The full GridView properties are below.
Thank you,
Scott
<asp:GridView ID="GenericTabl eMaintenanceGri dView"
AutoGenerateCol umns="true"
AutoGenerateEdi tButton="true"
AutoGenerateDel eteButton="true "
AutoGenerateSel ectButton="fals e"
CellPadding="5"
CellSpacing="5"
runat="server">
<FooterStyle BackColor="#FFF FFF" ForeColor="#FFF FFF" />
<RowStyle BackColor="#E7E 7FF" ForeColor="#4A3 C8C" />
<SelectedRowSty le BackColor="#738 A9C" ForeColor="#F7F 7F7" Wrap="false" />
<PagerStyle BackColor="#E7E 7FF" ForeColor="#4A3 C8C"
HorizontalAlign ="Right" />
<HeaderStyle BackColor="#4A3 C8C" Font-Bold="True" ForeColor="#F7F 7F7" />
<AlternatingRow Style BackColor="#F7F 7F7" />
</asp:GridView>
It will not work without a data source control (such as a
SqlDataSource control).

To make it working, create a SqlDataSource

<asp:sqldatasou rce id="myDS"
selectcommand=" ..."
updatecommand=" ..."
connectionstrin g="..."
runat="server">
</asp:sqldatasour ce>

and assign it to the data grid

<asp:gridview id="GenericTabl eMaintenanceGri dView"
datasourceid="m yDS"

Hope it helps- Hide quoted text -

- Show quoted text -

you can also use the data binding in the code-behind. In this case you
should use the OnEditCommand and the EditItemIndex property

here's some example (taken from a datagrid control)

<asp:gridview ...
OnEditCommand=" DataGrid1_Edit"
OnCancelCommand ="DataGrid1_Can cel"
OnUpdateCommand ="DataGrid1_Upd ate"
....

Public Sub DataGrid1_Edit( ByVal sender As Object, ByVal e As
DataGridCommand EventArgs)
DataGrid1.EditI temIndex = E.Item.ItemInde x
DataGrid1.DataS ource = ...
DataGrid1.DataB ind()
End Sub


May 4 '07 #4

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

Similar topics

0
7810
by: Stephen | last post by:
My primary GridView is firing an OnDataBound after Selecting a row (which triggers SelectedIndexChanged). This only happens in the following scenario: - User enters a textbox search value and hits "GO" - Gridview is filled with results (4 grids in all, only the "primary" is filled at this point) - User Selects a row from the gridview. - User clicks an "Add" button which calls a javascript window.showmodaldialog
3
19265
by: misiek | last post by:
Hi all. I have following problem: 1. In my web page I have a GridView control, which does not have a DataSourceId set in designer. 2. When user presses Start button then I create programatically a dataSet, set it as a DataSource for my GridView an add it to Session. 3. I want my users to be able to edit data displayed in GridView, so I added Edit command column. 4. When user clicks Edit, then I get the following error: "The GridView
1
402
by: Jim McGivney | last post by:
In VS-05 on an aspx page I have a GridView with a select item column. When the select button is pressed a DetailsView control opens with the selected record displayed. The user can now edit the record by pressing the edit button. After the record is edited in the DetailsView the update button is pressed. The problem is that the DetailsView now shows the correctly edited entry, while the GridView has not been updated. I can change...
8
7737
by: gerry | last post by:
The PagerSettings.Visible property is not being handled properly by the GridView control. The value assigned to this property is not applied until after a postback. Simplest test : .aspx containing a single gridview - enable paging and give enough data to page. add checkbox with auto postback enable add button with auto postback enable in the GridView1_PreRender method add the following : GridView1.HeaderRow.Enabled =
1
6134
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some label,textboxs,dropdownlists,radiobutton and checkbox asp standard controls. On the click event of the command button the data gets stored into the database. I have created the stored procedures for the insert,update,delete. I have...
1
10408
by: Evan M. | last post by:
Here's my GridView and my SqlDataSource <asp:GridView ID="ContactHistoryGrid" runat="server" AutoGenerateColumns="False" DataSourceID="ContactHistoryDS" DataKeyNames="JobHistoryID" OnRowCreated="ContactHistoryGrid_RowCreated" CssClass="GridViewTable" GridLines="None" CellSpacing="1" CellPadding="3" AllowSorting="True" AllowPaging="True"> <EmptyDataTemplate>
0
2224
by: lamolap | last post by:
i have 1 gridview , a dropdownlist inside a gridview and a commandfield of (edit, update and cancel) my gidview looks like this Edit Surname Initials ParkingBay CommandField Me Y dropdownlistvalue CommandField You m dropdownlistvalue i have 2 sqldatasource. the other one is for gridview and...
4
9790
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 sounds easy but the next requirement is that the GridView is editable. So I have included the SelectCommand and the UpdateCommand on the SqlDataSource to allow the GridView to be editable. I have now been able to get the GridView to display data...
11
6068
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know if that's what's causing the behavior or not. It seems like the Update button should at least do something. When the Edit button is clicked, the grid goes into Edit mode and the Cancel button takes the grid out of Edit mode. So, I don't get what...
0
9628
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9464
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10289
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9923
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7471
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2860
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.