FormView update not updating with ObjectDataSource

G

Guest

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top