Showing posts with label sqldatasouce. Show all posts
Showing posts with label sqldatasouce. Show all posts

Wednesday, March 21, 2012

Two-way data binding problem with Atlas UpdatePanel

I have an existing ASP 2.0 page which utilizes a SQLDataSouce and a FormView with bound controls. The page has a "save" button which saves the contents of the bound controls to the database. It works fine when not using Atlas.

One of the textboxes on the form is a date field. I want to use Atlas and the .Net Calendar control to provide a popup calendar. I implemented the calander based upon some simple example code I found in the Atlas tutorial. The popup works great and the value from the calendar is correctly placed into the target textbox.

The problem I am having is that wrapping the UpdatePanel around the textbox causes it to lose two-way databinding.It correctly displays the initial value from the current database record but, when attempting to do and update the value is always NULL. Does anyone know what I may be missing. Below is the Atlas markup wrapped around the textbox:

Thanks,

Tony

<atlas:updatepanel id="upCallReportDateTime" runat="server" mode="Conditional" rendermode="Inline"
<triggers>
<atlas:controleventtrigger controlid="calDatePicker" eventname="SelectionChanged" />
</triggers>

<contenttemplate>
<asp:textbox id="txtCallReportDateTime" runat="server"
Width="150px"
Text='<%# Bind("CallReportDateTime") %>'
CssClass="EditTextBox"
ontextchanged="txtCallReportDateTime_TextChanged"
autopostback="true"/>
<asp:imagebutton id="cmdPickDate_CallReportDateTime" runat="server"
onclick="cmdPickDate_CallReportDateTime_Click"
imageurl="graphics/calendar.gif"
height="20px"
width="20px"
CausesValidation="false" />
</contenttemplate>
</atlas:updatepanel>

Were you ever able to solve this problem? I am having the exact same problem.

The only way I've solved it so far is to add the missing parameter in the FormView_ItemInserting event.

This works well but it seems like I shouldn't have to do that.