473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

GridView Update Button Not Displayed

Hi,

My GridView is bound to a DataTable and the GridView properties are set
as follows:
AutoGenerateColumns="true"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="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="GenericTableMaintenanceGridView"
AutoGenerateColumns="true"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="true"
AutoGenerateSelectButton="false"
CellPadding="5"
CellSpacing="5"
runat="server">
<FooterStyle BackColor="#FFFFFF" ForeColor="#FFFFFF" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" ForeColor="#F7F7F7" Wrap="false" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C"
HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:GridView>
May 3 '07 #1
3 6918
On May 3, 5:11 pm, slemen <sle...@discussions.microsoft.comwrote:
Hi,

My GridView is bound to a DataTable and the GridView properties are set
as follows:
AutoGenerateColumns="true"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="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="GenericTableMaintenanceGridView"
AutoGenerateColumns="true"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="true"
AutoGenerateSelectButton="false"
CellPadding="5"
CellSpacing="5"
runat="server">
<FooterStyle BackColor="#FFFFFF" ForeColor="#FFFFFF" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" ForeColor="#F7F7F7" Wrap="false" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C"
HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:GridView>
It will not work without a data source control (such as a
SqlDataSource control).

To make it working, create a SqlDataSource

<asp:sqldatasource id="myDS"
selectcommand="..."
updatecommand="..."
connectionstring="..."
runat="server">
</asp:sqldatasource>

and assign it to the data grid

<asp:gridview id="GenericTableMaintenanceGridView"
datasourceid="myDS"

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...@discussions.microsoft.comwrote:


Hi,
My GridView is bound to a DataTable and the GridView properties are set
as follows:
AutoGenerateColumns="true"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="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="GenericTableMaintenanceGridView"
AutoGenerateColumns="true"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="true"
AutoGenerateSelectButton="false"
CellPadding="5"
CellSpacing="5"
runat="server">
<FooterStyle BackColor="#FFFFFF" ForeColor="#FFFFFF" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" ForeColor="#F7F7F7" Wrap="false" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C"
HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:GridView>

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

To make it working, create a SqlDataSource

<asp:sqldatasource id="myDS"
selectcommand="..."
updatecommand="..."
connectionstring="..."
runat="server">
</asp:sqldatasource>

and assign it to the data grid

<asp:gridview id="GenericTableMaintenanceGridView"
datasourceid="myDS"

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_Cancel"
OnUpdateCommand="DataGrid1_Update"
....

Public Sub DataGrid1_Edit(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
DataGrid1.EditItemIndex = E.Item.ItemIndex
DataGrid1.DataSource = ...
DataGrid1.DataBind()
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...@discussions.microsoft.comwrote:


Hi,
My GridView is bound to a DataTable and the GridView properties are set
as follows:
AutoGenerateColumns="true"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="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="GenericTableMaintenanceGridView"
AutoGenerateColumns="true"
AutoGenerateEditButton="true"
AutoGenerateDeleteButton="true"
AutoGenerateSelectButton="false"
CellPadding="5"
CellSpacing="5"
runat="server">
<FooterStyle BackColor="#FFFFFF" ForeColor="#FFFFFF" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" ForeColor="#F7F7F7" Wrap="false" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C"
HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:GridView>
It will not work without a data source control (such as a
SqlDataSource control).

To make it working, create a SqlDataSource

<asp:sqldatasource id="myDS"
selectcommand="..."
updatecommand="..."
connectionstring="..."
runat="server">
</asp:sqldatasource>

and assign it to the data grid

<asp:gridview id="GenericTableMaintenanceGridView"
datasourceid="myDS"

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_Cancel"
OnUpdateCommand="DataGrid1_Update"
....

Public Sub DataGrid1_Edit(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
DataGrid1.EditItemIndex = E.Item.ItemIndex
DataGrid1.DataSource = ...
DataGrid1.DataBind()
End Sub


May 4 '07 #4

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

Similar topics

0
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...
3
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...
1
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...
8
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...
1
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...
1
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"...
0
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 ...
4
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...
11
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
0
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...

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.