473,721 Members | 2,241 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FormView update not updating with ObjectDataSourc e

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

<asp:FormView ID="fvRegDetail " runat="server" DefaultMode="Ed it"
DataKeyNames="R egistrantId" DataSourceID="o dsRegistrant"
CssClass="waFor mView" >
<EditItemTempla te>
....
<asp:Button ID="UpdateButto n" runat="server" CausesValidatio n="True"
CommandName="Up date" Text="Update" ValidationGroup ="regForm">
</asp:Button>

<asp:ObjectData Source ID="odsRegistra nt" runat="server"
TypeName="Regis trantDB" SelectMethod="G etRegistrant"
UpdateMethod="U pdateRegistrant " DataObjectTypeN ame="Registrant Details"
ConvertNullToDB Null="true">
<SelectParamete rs>
<asp:SessionPar ameter DefaultValue="6 0" Name="registran tId"
SessionField="R egistrantId"
Type="Int32" />
</SelectParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="firstName " Type="String" />
<asp:Paramete r Name="mI" Type="String" />
<asp:Paramete r Name="lastName" Type="String" />
<asp:Paramete r Name="eMail" Type="String" />
...

My TypeName has:
public void UpdateRegistran t( RegistrantDetai ls reg ) {
SqlConnection con = new SqlConnection( connectionStrin g );
SqlCommand cmd = new SqlCommand( "UpdateRegistra nt", con );
cmd.CommandType = CommandType.Sto redProcedure;
cmd.Parameters. Add( new SqlParameter( "@FirstName ", SqlDbType.NVarC har,
25 ) );
cmd.Parameters["@FirstName "].Value = reg.FirstName == null ? "" :
reg.FirstName;
....

And my DataObjectTypeN ame has:
public RegistrantDetai ls(){}
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 6824
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 ObjectDataSourc e that's not updating and am
wondering what I missed..

<asp:FormView ID="fvRegDetail " runat="server" DefaultMode="Ed it"
DataKeyNames="R egistrantId" DataSourceID="o dsRegistrant"
CssClass="waFor mView" >
<EditItemTempla te>
....
<asp:Button ID="UpdateButto n" runat="server" CausesValidatio n="True"
CommandName="Up date" Text="Update" ValidationGroup ="regForm">
</asp:Button>

<asp:ObjectData Source ID="odsRegistra nt" runat="server"
TypeName="Regis trantDB" SelectMethod="G etRegistrant"
UpdateMethod="U pdateRegistrant " DataObjectTypeN ame="Registrant Details"
ConvertNullToDB Null="true">
<SelectParamete rs>
<asp:SessionPar ameter DefaultValue="6 0" Name="registran tId"
SessionField="R egistrantId"
Type="Int32" />
</SelectParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="firstName " Type="String" />
<asp:Paramete r Name="mI" Type="String" />
<asp:Paramete r Name="lastName" Type="String" />
<asp:Paramete r Name="eMail" Type="String" />
...

My TypeName has:
public void UpdateRegistran t( RegistrantDetai ls reg ) {
SqlConnection con = new SqlConnection( connectionStrin g );
SqlCommand cmd = new SqlCommand( "UpdateRegistra nt", con );
cmd.CommandType = CommandType.Sto redProcedure;
cmd.Parameters. Add( new SqlParameter( "@FirstName ", SqlDbType.NVarC har,
25 ) );
cmd.Parameters["@FirstName "].Value = reg.FirstName == null ? "" :
reg.FirstName;
...

And my DataObjectTypeN ame has:
public RegistrantDetai ls(){}
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
2175
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 ID="FormView1" runat="server" DataSourceID="ObjectDataSource1"> <EditItemTemplate>
0
2417
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 ID="FormView1" runat="server" DataSourceID="ObjectDataSource1"> <EditItemTemplate>
0
4744
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 through an objectdatasource. The paging on my GridView works fine except that when I change the page the FormView does not update. I tried setting the selectedindex to 0 in the GridView's PageIndexChanged event and manually binding the formview...
0
1229
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 Update method. This behavior is fine when update method succeeds. But the problem is that when for some reason (e.g. a business rule "start date can not be prior to 1/1/2006") business layer rejects the data and Update method returns False (or...
1
6567
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). The field bounded in the database (MySql) is a string field (ENUM('True','False') default 'False'. The checkbox is correctly bounded in the itemtemplate and in the edititemtemplate.
0
1989
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...
1
1741
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 update or insert mode. Protected Sub tvwmenu_SelectedNodeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles tvwmenu.SelectedNodeChanged ViewState("menuid") = menuid ViewState("parentid") = parentid If menuid <0 Then
3
8100
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 BLL methods that implements the optimistic concurrency by a TimeStamp field into the DB. So, when I execute an insert, update or delete query if I receive 0 like return value from that queries I understand that a concurrency problem is occurs so...
2
2635
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 an ObjectDataSource for a FormView control. MyObjectDataSource has public properties that correspond to db table columns and are also used to < %# Bind("")%Input controls in the formview declaratively. There is an Update method in...
0
8858
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
8738
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
9230
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
9085
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...
0
8026
agi2029
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...
1
6678
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...
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2596
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2146
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.