Re: GridView update problem
- From: "SAL" <SAL@xxxxxxxxxxxxx>
- Date: Tue, 15 Jul 2008 11:17:29 -0700
Steven,
I created a sample test project per your instructions and e-mailed it to
you. I have been waiting on you to check that code out and reply to me
directly I thought. Maybe not though. Did you not recieve the sample
project?
S
"Steven Cheng [MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:JjzgFLm5IHA.6088@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi SAL,
How are you doing?
have you got any progress on this issue or does the information I provided
in last message help you some? If there is anything else need help, please
feel free to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
even Cheng [MSFT])
Organization: Microsoft
Date: Fri, 11 Jul 2008 06:01:11 GMT
Subject: Re: GridView update problem
I
Hi SAL,
I've received your email and performed some tests on the page you
provided.
It seems you have many different code logic on the GridView+ ODataSource
editing/updating. I haven't looked deep into the database layer and after
some testing at the page/gridview layer, I found the following problems:
1. You have added some button and textbox in the GridView's Footer(of some
template fields) so as for inserting some records. However, since the
Textbox in insert template has requiredFieldValidator associated, when you
try editing/updating and submit update, the validation of the Insert
textbox will prevent it from postback the page. To address the problem,
have used the following means:in
#for TextBox, Validator and button in FooterTemplate, I set a separate
"ValidationGroup" for them so that they'll not affect the edit/update of
Gridview
==========
<asp:TextBox ID="txtDbsId"
..................ValidationGroup="Insert_Group"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1".....................
ValidationGroup="Insert_Group">*</asp:RequiredFieldValidator>
<asp:Button ID="btnAdd" runat="server" Text="Add" CommandName="Insert"
EnableViewState="False"
ValidationGroup="Insert_Group" />
============================
After that, the page can be submit correctly when we hit "update" button
edit mode.and
2. When the page postback to server-side, the Server-side validation
function will also query database to validate some input values. I'm not
sure the actual database schema and code logic, but you also need to check
this since if this fails, the updating event will not be reached.
3. You have registered the "RowUpdating" event, however, you've also add
the following code in "Rowcommand" event:
+===========
'ElseIf e.CommandName = "Update" AndAlso Page.IsValid Then
' dsGISLayers.Update()
'End If
===================
If you want to manually do the updating, you only need the "RowUpdating"
event and you can get all the parameters from the parameters collection
do your own ADO.NET code, after that call e.Cancel=True so as to prevente
the built-in updating code logic:
====================
Protected Sub gvGISLayerEdit_RowUpdating(ByVal sender As Object, ByVal
As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handlesf
gvGISLayerEdit.RowUpdating
Response.Write("<br/>gvGISLayerEdit_RowUpdating")
'get parameters from e.NewValues , e.OldValues, e.RowIndex
' and all TableAdapter to update
e.Cancel = True
End Sub
===================
Simply call ObjectDataSource.Update will not take effect since you haven't
registered its "Updating" event and supply the necessary parameters for
it.
BTW, for ASP.NET data accesing, you can refer to some good examples and
tutorial from the following site:
http://www.asp.net/learn/data-access/
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#noti
ications.I
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: "SAL" <SAL@xxxxxxxxxxxxx><e5Of00X4IHA.4688@xxxxxxxxxxxxxxxxxxxxxx> <O72hdQe4IHA.5112
References: <OhWH06T4IHA.2580@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: GridView update problem
Date: Thu, 10 Jul 2008 10:31:34 -0700
update
Steven,
I have sent a small project that exhibits this symptom.
S
"Steven Cheng [MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:37vfutj4IHA.4056@xxxxxxxxxxxxxxxxxxxxxxxxx
Thanks for your reply SAL,
That seems unexpected since the postback should work as long as the
button is put correctly(via edit/update command field). Is it reproable
via
some simplified data source? You can send me a simplified copy so that
andcan also test it on my side. My email is
"stcheng" + @ + "microsoft.com"
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
Pleasesuggestions about how we can improve the support we provide to you.
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
.
- References:
- GridView update problem
- From: SAL
- RE: GridView update problem
- From: Steven Cheng [MSFT]
- Re: GridView update problem
- From: SAL
- Re: GridView update problem
- From: Steven Cheng [MSFT]
- Re: GridView update problem
- From: SAL
- Re: GridView update problem
- From: Steven Cheng [MSFT]
- Re: GridView update problem
- From: Steven Cheng [MSFT]
- GridView update problem
- Prev by Date: ASP.NET MVS and ASP.NET Dynamic Data
- Next by Date: Re: ASP.NET MVS and ASP.NET Dynamic Data
- Previous by thread: Re: GridView update problem
- Next by thread: Re: GridView update problem
- Index(es):
Loading