Hi,
I am using gridview and sql datasource for select and update. When I
click on edit link against the records, the row is shows in edit mode.
When I make a change to it, the change is not updated and no errors
returned.
Here is the source.. Please help.
<asp:GridView ID="gvEvidence " runat="server" AllowPaging="Tr ue"
AllowSorting="T rue"
AutoGenerateCol umns="False" BackColor="Ligh tGoldenrodYello w"
BorderColor="Ta n"
BorderWidth="1p x" CellPadding="2" Font-Bold="False"
Font-Overline="False " Font-Size="1.25em" ForeColor="Blac k"
Width="100%" DataKeyNames="F rameworkEvidenc eId"
DataSourceID="D SEvidenceForAct ion">
<FooterStyle BackColor="Tan" Font-Size="1.2em" />
<Columns>
<asp:CommandFie ld ShowEditButton= "True" />
<asp:BoundFie ld DataField="Acti onMasterDisplay No"
HeaderText="Act ion No." SortExpression= "ActionMasterDi splayNo"
ReadOnly="True" />
<asp:BoundFie ld DataField="Acti onMasterDesc"
HeaderText="Act ion" SortExpression= "ActionMasterDe sc" ReadOnly="True"
/>
<asp:TemplateFi eld HeaderText="Ach ieved"
SortExpression= "FrameworkEvide nceAchieved"
ConvertEmptyStr ingToNull="Fals e">
<EditItemTempla te>
<asp:DropDownLi st ID="cboAchieved " runat="server"
SelectedValue=' <%# Bind("Framework EvidenceAchieve d") %>'>
<asp:ListItem Selected="True"
Value="yes">Yes </asp:ListItem>
<asp:ListItem Value="no">No</asp:ListItem>
<asp:ListItem Value="partial progress">Parti al
Progress</asp:ListItem>
<asp:ListItem Value="not applicable">Not
Applicable</asp:ListItem>
<asp:ListItem
Value="-">--Select--</asp:ListItem>
</asp:DropDownLis t>
</EditItemTemplat e>
<ItemTemplate >
<asp:Label ID="Label1" runat="server" Text='<%#
Bind("Framework EvidenceAchieve d") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:TemplateFi eld HeaderText="Evi dence"
SortExpression= "FrameworkEvide nceDesc"
ConvertEmptyStr ingToNull="Fals e">
<EditItemTempla te>
<asp:TextBox ID="txtEvidence Desc" runat="server"
Text='<%# Bind("Framework EvidenceDesc") %>'
TextMode="Multi Line"></asp:TextBox>
</EditItemTemplat e>
<ItemTemplate >
<asp:Label ID="Label2" runat="server" Text='<%#
Bind("Framework EvidenceDesc") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:TemplateFi eld HeaderText="Evi dence Ref"
SortExpression= "FrameworkEvide nceRef" ConvertEmptyStr ingToNull="Fals e">
<EditItemTempla te>
<asp:TextBox ID="txtEvidence Ref" runat="server"
MaxLength="150" Text='<%# Bind("Framework EvidenceRef")
%>'></asp:TextBox>
</EditItemTemplat e>
<ItemTemplate >
<asp:Label ID="Label3" runat="server" Text='<%#
Bind("Framework EvidenceRef") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:TemplateFi eld HeaderText="Upd ated By"
SortExpression= "FrameworkEvide nceUpdatedBy"
ConvertEmptyStr ingToNull="Fals e">
<EditItemTempla te>
<asp:Labe l ID="lblUpdatedB y" runat="server"
Text="<%# GetLoggedInUser Id() %>"></asp:Label>
</EditItemTemplat e>
<ItemTemplate >
<asp:Label ID="Label4" runat="server" Text='<%#
Bind("Framework EvidenceUpdated By") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:TemplateFi eld HeaderText="Dat e"
SortExpression= "FrameworkEvide nceUpdatedDate"
ConvertEmptyStr ingToNull="Fals e">
<EditItemTempla te>
<asp:Label ID="lblUpdatedD ate" runat="server"
Text="<%# now() %>"></asp:Label>
</EditItemTemplat e>
<ItemTemplate >
<asp:Label ID="Label5" runat="server" Text='<%#
Bind("Framework EvidenceUpdated Date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>
<SelectedRowSty le BackColor="Dark SlateBlue"
ForeColor="Ghos tWhite" Font-Size="1.25em" />
<PagerStyle BackColor="Pale Goldenrod" ForeColor="Dark SlateBlue"
HorizontalAlign ="Center" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRow Style BackColor="Pale Goldenrod" />
<EditRowStyle BackColor="Gold " BorderColor="Ho tTrack"
Font-Size="1.25em" />
<EmptyDataTempl ate>
Sorry, no data available.
</EmptyDataTempla te>
<EmptyDataRowSt yle Font-Size="1.25em" />
</asp:GridView>
<asp:SqlDataSou rce ID="DSEvidenceF orAction" runat="server"
ConnectionStrin g="<%$ ConnectionStrin gs:EqualitiesDb Conn %>"
SelectCommand=" ProcFrameworkEv idenceSelectALL ByDeptId"
SelectCommandTy pe="StoredProce dure" UpdateCommand=" UPDATE
dbo.FrameworkEv idence SET FrameworkEviden ceAchieved =
@evidenceAchiev ed, FrameworkEviden ceRef = @evidenceRef,
FrameworkEviden ceDesc = @evidenceDesc, FrameworkEviden ceUpdatedBy =
@updatedBy, FrameworkEviden ceUpdatedDate = @updatedDate WHERE
(FrameworkEvide nceId = @frameid)">
<SelectParamete rs>
<asp:Paramete r DefaultValue="3 " Name="dept_id" Type="Int64"
/>
</SelectParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="evidenceA chieved" Type="String" />
<asp:Paramete r Name="evidenceR ef" Type="String" />
<asp:Paramete r Name="evidenceD esc" Type="String" />
<asp:Paramete r Name="updatedBy " Type="String" />
<asp:Paramete r Name="updatedDa te" Type="DateTime" />
<asp:Paramete r Name="frameid" Type="Int64" />
</UpdateParameter s>
</asp:SqlDataSour ce>
Thanks in advance!! 5 5432
Have you specified the DataKeys?
"teclioness " <gu********@gma il.com> wrote in message
news:11******** *************@z 34g2000cwc.goog legroups.com... Hi,
I am using gridview and sql datasource for select and update. When I click on edit link against the records, the row is shows in edit mode. When I make a change to it, the change is not updated and no errors returned. Here is the source.. Please help.
<asp:GridView ID="gvEvidence " runat="server" AllowPaging="Tr ue" AllowSorting="T rue" AutoGenerateCol umns="False" BackColor="Ligh tGoldenrodYello w" BorderColor="Ta n" BorderWidth="1p x" CellPadding="2" Font-Bold="False" Font-Overline="False " Font-Size="1.25em" ForeColor="Blac k" Width="100%" DataKeyNames="F rameworkEvidenc eId" DataSourceID="D SEvidenceForAct ion"> <FooterStyle BackColor="Tan" Font-Size="1.2em" /> <Columns> <asp:CommandFie ld ShowEditButton= "True" /> <asp:BoundFie ld DataField="Acti onMasterDisplay No" HeaderText="Act ion No." SortExpression= "ActionMasterDi splayNo" ReadOnly="True" /> <asp:BoundFie ld DataField="Acti onMasterDesc" HeaderText="Act ion" SortExpression= "ActionMasterDe sc" ReadOnly="True" /> <asp:TemplateFi eld HeaderText="Ach ieved" SortExpression= "FrameworkEvide nceAchieved" ConvertEmptyStr ingToNull="Fals e"> <EditItemTempla te> <asp:DropDownLi st ID="cboAchieved " runat="server" SelectedValue=' <%# Bind("Framework EvidenceAchieve d") %>'> <asp:ListItem Selected="True" Value="yes">Yes </asp:ListItem> <asp:ListItem Value="no">No</asp:ListItem> <asp:ListItem Value="partial progress">Parti al Progress</asp:ListItem> <asp:ListItem Value="not applicable">Not Applicable</asp:ListItem> <asp:ListItem Value="-">--Select--</asp:ListItem> </asp:DropDownLis t> </EditItemTemplat e> <ItemTemplate > <asp:Label ID="Label1" runat="server" Text='<%# Bind("Framework EvidenceAchieve d") %>'></asp:Label> </ItemTemplate> </asp:TemplateFie ld> <asp:TemplateFi eld HeaderText="Evi dence" SortExpression= "FrameworkEvide nceDesc" ConvertEmptyStr ingToNull="Fals e"> <EditItemTempla te> <asp:TextBox ID="txtEvidence Desc" runat="server" Text='<%# Bind("Framework EvidenceDesc") %>' TextMode="Multi Line"></asp:TextBox> </EditItemTemplat e> <ItemTemplate > <asp:Label ID="Label2" runat="server" Text='<%# Bind("Framework EvidenceDesc") %>'></asp:Label> </ItemTemplate> </asp:TemplateFie ld> <asp:TemplateFi eld HeaderText="Evi dence Ref" SortExpression= "FrameworkEvide nceRef" ConvertEmptyStr ingToNull="Fals e"> <EditItemTempla te> <asp:TextBox ID="txtEvidence Ref" runat="server" MaxLength="150" Text='<%# Bind("Framework EvidenceRef") %>'></asp:TextBox> </EditItemTemplat e> <ItemTemplate > <asp:Label ID="Label3" runat="server" Text='<%# Bind("Framework EvidenceRef") %>'></asp:Label> </ItemTemplate> </asp:TemplateFie ld> <asp:TemplateFi eld HeaderText="Upd ated By" SortExpression= "FrameworkEvide nceUpdatedBy" ConvertEmptyStr ingToNull="Fals e"> <EditItemTempla te> <asp:Labe l ID="lblUpdatedB y" runat="server" Text="<%# GetLoggedInUser Id() %>"></asp:Label> </EditItemTemplat e> <ItemTemplate > <asp:Label ID="Label4" runat="server" Text='<%# Bind("Framework EvidenceUpdated By") %>'></asp:Label> </ItemTemplate> </asp:TemplateFie ld> <asp:TemplateFi eld HeaderText="Dat e" SortExpression= "FrameworkEvide nceUpdatedDate" ConvertEmptyStr ingToNull="Fals e"> <EditItemTempla te> <asp:Label ID="lblUpdatedD ate" runat="server" Text="<%# now() %>"></asp:Label> </EditItemTemplat e> <ItemTemplate > <asp:Label ID="Label5" runat="server" Text='<%# Bind("Framework EvidenceUpdated Date") %>'></asp:Label> </ItemTemplate> </asp:TemplateFie ld> </Columns> <SelectedRowSty le BackColor="Dark SlateBlue" ForeColor="Ghos tWhite" Font-Size="1.25em" /> <PagerStyle BackColor="Pale Goldenrod" ForeColor="Dark SlateBlue" HorizontalAlign ="Center" /> <HeaderStyle BackColor="Tan" Font-Bold="True" /> <AlternatingRow Style BackColor="Pale Goldenrod" /> <EditRowStyle BackColor="Gold " BorderColor="Ho tTrack" Font-Size="1.25em" /> <EmptyDataTempl ate> Sorry, no data available. </EmptyDataTempla te> <EmptyDataRowSt yle Font-Size="1.25em" /> </asp:GridView> <asp:SqlDataSou rce ID="DSEvidenceF orAction" runat="server" ConnectionStrin g="<%$ ConnectionStrin gs:EqualitiesDb Conn %>" SelectCommand=" ProcFrameworkEv idenceSelectALL ByDeptId" SelectCommandTy pe="StoredProce dure" UpdateCommand=" UPDATE dbo.FrameworkEv idence SET FrameworkEviden ceAchieved = @evidenceAchiev ed, FrameworkEviden ceRef = @evidenceRef, FrameworkEviden ceDesc = @evidenceDesc, FrameworkEviden ceUpdatedBy = @updatedBy, FrameworkEviden ceUpdatedDate = @updatedDate WHERE (FrameworkEvide nceId = @frameid)"> <SelectParamete rs> <asp:Paramete r DefaultValue="3 " Name="dept_id" Type="Int64" /> </SelectParameter s> <UpdateParamete rs> <asp:Paramete r Name="evidenceA chieved" Type="String" /> <asp:Paramete r Name="evidenceR ef" Type="String" /> <asp:Paramete r Name="evidenceD esc" Type="String" /> <asp:Paramete r Name="updatedBy " Type="String" /> <asp:Paramete r Name="updatedDa te" Type="DateTime" /> <asp:Paramete r Name="frameid" Type="Int64" /> </UpdateParameter s> </asp:SqlDataSour ce>
Thanks in advance!!
Hi,
Yes, I tried with the datakeys as well. Still no errors and not
updating either..
Don't understand what I am doing wrong...
Any help would be appreciated.
I found the solution. I had to name the parameters the same name as the
ones that I was getting in select query. The following article helped
me: http://www.whitworth.org/Blog/Commen...2d2fc191e.aspx
But I have another issue. In last 2 columns, I have to show the logged
in person's windows IId and the current date, when the person cliks on
edit and save to database when user clicks on update.
Please help!!!
You could use the GridView's RowEditing and RowUpdating events.
Hi,
Would I still be able to use the Sqldatasource update feature? Is there
any example you can help me with? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: |
last post by:
Hello,
I have created an ASP.NET 2.0 application that utilized a Gridview Control
to display and update/delete data.
The problem I am having is that the gridview control is displaying the data
correctly but it is not updating or deleting the rows. What I did was, in
design view, added a gridview control and added an sqldatasource control. I
configured the data source to update and delete. In the gridview tasks I
selected enable...
|
by: MasterChief |
last post by:
Is it possible to select an item on a gridview by clicking on it and
then being able to click a link for example that says EditOrder in a
treeview and have the EditOrder page open up viewing what you selected
in the gridview? My EditOrder link is in a sitemap so I don't know if
it is possible becuase you would almost have to pass a variable to the
sitemap. What would be the easiest way to accomplish it?
|
by: Michael Kellogg |
last post by:
I have a problem wherein a query that updates a GridView doesn't seem to
really stay in sync with a label I have above the GridView.
I have a GridView object that I'm updating with information whenever my
user enters a job number into a textbox and hits a button. There is a
SQLDataSource object on the page that does the retrieval of the data, and
the job number parameter for its query is bound to the textbox "Text"
value. In the button...
|
by: pblack9455 |
last post by:
I have a simple requirement to bind a small ArrayList of (ItemLine) Objects
to a GridView control. The Gridview renders on the page and allows me to
click update/edit buttons...however the data does not change, and in the
updated and updating row events the newValues collections are empty!!!
I've tried various other methods such as using an ObjectDataSource, but my
ArrayList does not existing in a database until after the editing and...
|
by: cpnet |
last post by:
I have a GridView which I'm populating from an ObjectDataSource (give the
GridView a DataTable). The GridView will have about 20 rows, and only one
editable column. The editable column consists of a RadioButtonList ("Yes",
"No", "Not Answered") in a TemplateColumn. I want the user to be able to
select a radio button for each row in the GridView (without having to first
put each row into edit mode). Once the user has selected the Radio...
| |
by: =?Utf-8?B?TGFkaXNsYXYgTXJua2E=?= |
last post by:
Hello,
I read some msdn and other articles about how does databinding among
DataSource controls and FormView / GridView controls works but I still don't
fully understand to this blackbox. I have few questions and hopefully you can
provide me some answers.
1. Best place for DataBinding.
Where is the best place for calling DataBind method? Is it possible to say
don't bind controls for this postback and use current values instead? These...
|
by: Japskunk |
last post by:
I am having trouble updating a SQL table through the GridView "Auto"
Enable Edit Feature...
I am connecting to a SQL 2000 Server with a SQLDataSource
I have created the Update Query in the Command and Parameter Editor
setup when I created my SQLadapter, along with Select and Delete.
Here is the Update Command:
UPDATE TBLUPSData SET UPSModel = @original_UPSModel, UPSLocation =
@original_UPSLocation, UPSDeviceAttached =...
|
by: McGeeky |
last post by:
Hi.
Is there an example available for GridViews that demonstrate how they can
support paging and updating? E.g. say I make some changes in the first page
of data on a GridView then switch to page 2, how are the changes in page 1
preserved? Does the GridView do it automatically? Does it require custom
programming?
Thanks!
|
by: David C |
last post by:
I have a new GridView that has an SQL table as a datasource. The primary
key is included but not visible. When I click the Edit link button, change
a column's data and click Update, nothing changes and I do not get any
error. The UPDATE has a WHERE clause of "WHERE ID = @ID" and the ID field is
in the Update Parameters. Can anyone help me resolve this? I am doing the
same thing with other tables and they are updating fine. Thanks.
...
|
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...
|
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...
| |
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,...
|
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |