473,398 Members | 2,335 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,398 software developers and data experts.

FormView update not updating with ObjectDataSource

I have a FormView tied to ObjectDataSource that's not updating and am
wondering what I missed..

<asp:FormView ID="fvRegDetail" runat="server" DefaultMode="Edit"
DataKeyNames="RegistrantId" DataSourceID="odsRegistrant"
CssClass="waFormView" >
<EditItemTemplate>
....
<asp:Button ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" ValidationGroup="regForm">
</asp:Button>

<asp:ObjectDataSource ID="odsRegistrant" runat="server"
TypeName="RegistrantDB" SelectMethod="GetRegistrant"
UpdateMethod="UpdateRegistrant" DataObjectTypeName="RegistrantDetails"
ConvertNullToDBNull="true">
<SelectParameters>
<asp:SessionParameter DefaultValue="60" Name="registrantId"
SessionField="RegistrantId"
Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="firstName" Type="String" />
<asp:Parameter Name="mI" Type="String" />
<asp:Parameter Name="lastName" Type="String" />
<asp:Parameter Name="eMail" Type="String" />
...

My TypeName has:
public void UpdateRegistrant( RegistrantDetails reg ) {
SqlConnection con = new SqlConnection( connectionString );
SqlCommand cmd = new SqlCommand( "UpdateRegistrant", con );
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add( new SqlParameter( "@FirstName", SqlDbType.NVarChar,
25 ) );
cmd.Parameters["@FirstName"].Value = reg.FirstName == null ? "" :
reg.FirstName;
....

And my DataObjectTypeName has:
public RegistrantDetails(){}
protected string firstName = String.Empty;
public string FirstName
{
get {return firstName;}
set {if (value != null){firstName = value;}}
}
....

Thanks for any clues as to what I must have missed. No exceptions are
generated and debugger shows the set and update methods aren't invoked.

Thanks much.
Apr 13 '06 #1
1 6795
I figured out the problem. A validation control was actually tripping and
keeping the page from updating. For some reason the validation controls don't
display errors or the validation summary in Firefox. But when I tested in IE
I found the error message. I was hoping cross browser support had improved in
ASP.NET v2.0.

"Dabbler" wrote:
I have a FormView tied to ObjectDataSource that's not updating and am
wondering what I missed..

<asp:FormView ID="fvRegDetail" runat="server" DefaultMode="Edit"
DataKeyNames="RegistrantId" DataSourceID="odsRegistrant"
CssClass="waFormView" >
<EditItemTemplate>
....
<asp:Button ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" ValidationGroup="regForm">
</asp:Button>

<asp:ObjectDataSource ID="odsRegistrant" runat="server"
TypeName="RegistrantDB" SelectMethod="GetRegistrant"
UpdateMethod="UpdateRegistrant" DataObjectTypeName="RegistrantDetails"
ConvertNullToDBNull="true">
<SelectParameters>
<asp:SessionParameter DefaultValue="60" Name="registrantId"
SessionField="RegistrantId"
Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="firstName" Type="String" />
<asp:Parameter Name="mI" Type="String" />
<asp:Parameter Name="lastName" Type="String" />
<asp:Parameter Name="eMail" Type="String" />
...

My TypeName has:
public void UpdateRegistrant( RegistrantDetails reg ) {
SqlConnection con = new SqlConnection( connectionString );
SqlCommand cmd = new SqlCommand( "UpdateRegistrant", con );
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add( new SqlParameter( "@FirstName", SqlDbType.NVarChar,
25 ) );
cmd.Parameters["@FirstName"].Value = reg.FirstName == null ? "" :
reg.FirstName;
...

And my DataObjectTypeName has:
public RegistrantDetails(){}
protected string firstName = String.Empty;
public string FirstName
{
get {return firstName;}
set {if (value != null){firstName = value;}}
}
...

Thanks for any clues as to what I must have missed. No exceptions are
generated and debugger shows the set and update methods aren't invoked.

Thanks much.

Apr 13 '06 #2

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

Similar topics

0
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView...
0
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView...
0
by: ThePurpleCat | last post by:
Hi, I'm a newbie to ASP.NET programming but not to Visual Studio. I'm having trouble getting my Master-Details page to work. I have a page enabled GridView which is linked to a FormView control...
0
by: sanjeev06 | last post by:
When Updating using a FormView and ObjectDataSource, the formview always does the data-binding of its controls and the field values in the FormView are always overwritten by the results of the...
1
by: Pao | last post by:
I have a formview bounded to an objectdatasource. All ok but I have some trouble with a checkbox: when I am in update mode and I update the record, this field is never updated (no errors thrown)....
0
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...
1
by: Chris | last post by:
I have a treeview control, which I use to select a row in a table which will be used to populate a formview. Depending on what node is selected in the treeview I want the formview to be either in...
3
by: KaOne | last post by:
Hi All, excuse me in advance for my not very perfect english. I need some help about a problem with a FormView bounded to an ObjectDataSource. In practise I have an ObjectDataSource that uses some...
2
by: Aamir Ghanchi | last post by:
Hi, Why does the Update method of an ObjectDataSource class requires parameters for each of the Bind input controls of a FormView? I have a class (say MyObjectDataSource) that is being used as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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
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,...
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...
0
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
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
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...

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.