Click to See Complete Forum and Search --> : FormViews and Atlas (UpdatePanels)


JoeyD
07-18-2007, 01:49 PM
I am usinging a formview that is wrapped in an updatePanel. I have an ObjectDataSource, and tried the SQLDatasource, Binding the formview. The datasource is in the main placeholder outside any of the UpdatePanels. The first postback after the page loads the Formview databind method is called. After the first postback I can click the same postback event i did before and it works as expected.

Heres my page: - scriptmanager and javascript



<asp:ObjectDataSource ID="odsSafetyAssessment" runat="server" InsertMethod="Insert"
SelectMethod="GetData" TypeName="SafetyAssessment.SafetyTableAdapters.SafetyMain_SelectTableAdapter" OnInserted="odsSafetyAssessment_Inserted" OnInserting="odsSafetyAssessment_Inserting">
<SelectParameters>
<asp:ControlParameter ControlID="ddlDate" Name="safetyDate" PropertyName="SelectedValue"
Type="DateTime" />
<asp:ControlParameter ControlID="ddlLine" Name="lineID" PropertyName="SelectedValue"
Type="Int32" />
<asp:ControlParameter ControlID="ddlAssociate" Name="assocID" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Direction="InputOutput" Name="safetyID" Type="Object" />
<asp:ControlParameter ControlID="ddlDate" Name="safetyDate" PropertyName="SelectedValue"
Type="DateTime" />
<asp:ControlParameter ControlID="ddlLine" Name="lineID" PropertyName="SelectedValue"
Type="Int32" />
<asp:ControlParameter ControlID="ddlAssociate" Name="assocID" PropertyName="SelectedValue"
Type="Int32" />
<asp:Parameter Name="pain" Type="Int32" />
</InsertParameters>
</asp:ObjectDataSource>


<ajax:UpdatePanel ID="upSafetyAssessment" runat="server" RenderMode="Inline" UpdateMode="Conditional">
<Triggers>
<ajax:AsyncPostBackTrigger ControlID="ddlAssociate" EventName="SelectedIndexChanged" />
<ajax:AsyncPostBackTrigger ControlID="ddlDate" EventName="SelectedIndexChanged" />
<ajax:AsyncPostBackTrigger ControlID="ddlLine" EventName="SelectedIndexChanged" />
<ajax:AsyncPostBackTrigger ControlID="ddlShift" EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:FormView ID="fvSafetyAssessment" runat="server" DefaultMode="Insert" Width="100%" DataKeyNames="safetyID" DataSourceID="odsSafetyAssessment" OnDataBound="fvSafetyAssessment_DataBound">

lmf232s
07-18-2007, 03:22 PM
You dont really describe the problem your having.
Can you explain a bit more?
Is the formview not updating?
Is the update not working?

JoeyD
07-19-2007, 05:52 AM
Thanks for the response lmf232s.

Everything works fine. However after the first page load, anything I click that postsback will re-databind the formview. After the first postback everthing works fine. One example of this is a checkbox inside my formview insert template, which is the default mode. When I check this it does a postback and the firsttime the page postsback the formview databinds clearing the checkbox I just checked. If I click the same checkbox again the formview doesn't databind and works as I expect it to. I am using UpdatePanels and triggers. My triggers, formview parameters -> dropdowns, are also inside there own updatePanels.

lmf232s
07-19-2007, 04:45 PM
Can you post some code from your code behind?

Do you have something like this in your page load

If Not Page.IsPostBack Then
'Bind data for the first time
Else
'Its a post back do not bind the data again
End If


EDIT:
I also notice you ajax tags have the prefix <ajax:> instead of <asp>. Have you updated to the newest version of AJAX? Not sure if that will fix the problem but just something I noticed.