Welcome Guest Search | Active Topics | Sign In | Register

Error DatePicker UpdatePanel GridView Options
Luis German
Posted: Tuesday, July 24, 2007 10:32:09 AM
Rank: Newbie
Groups: Member

Joined: 6/7/2007
Posts: 6
I have the next error with a DatePicker :

UpdatePanel
GridView
TemplateItem
DatePicker

Error : An OE.Web Control is rendered after un AJAX Callback

we placed a control EO.WEB by outside updatepanel and he does not work that we can do?

EO.Web Version is 4.0.23.2
eo_support
Posted: Tuesday, July 24, 2007 11:30:26 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Luis,

Thanks for posting your question here. Try to place an empty Callback control or UpdatePanel control outside of ASP.NET UpatePanel. That control will not render anything, the purpose of the control is make sure that our controls "join the party" before the AJAX call took place.

Once you do that you should no longer get the error message.

Thanks
Luis German
Posted: Tuesday, July 24, 2007 12:25:52 PM
Rank: Newbie
Groups: Member

Joined: 6/7/2007
Posts: 6
Hi, we made the test of the following form:


callback- empty
updatepanel - user control
updatepanel
gridview
itemtemplate
datepicker

now it does not unfold the error but the DatePicker does not update the value when we changed by day
eo_support
Posted: Tuesday, July 24, 2007 12:35:21 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Luis,

Can you make a sample app for us that reproduces the error? I am not sure what exactly you mean by "the DatePicker does not update the value when we changed by day". So I think if you can provide some code so that we can run it at here and see then we should be able to tell exactly why and to also offer a solution for you.

Thanks
Luis German
Posted: Tuesday, July 24, 2007 1:45:07 PM
Rank: Newbie
Groups: Member

Joined: 6/7/2007
Posts: 6
difficult example since it is a very great application and it has many components you we can publish the application in a server ours that this in Internet, can it help you?
eo_support
Posted: Tuesday, July 24, 2007 1:49:59 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Luis,

We will need to take a look then. We have created an online meeting for you. Please see your private messages for the meeting link.

Thanks
eo_support
Posted: Tuesday, July 24, 2007 2:01:02 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Luis,

We see you joined and then left the meeting. We need to see the error in order to find a solution for you. If you don't even want to show us the error, then we can't really help you too much.

Thanks
eo_support
Posted: Tuesday, July 24, 2007 3:46:39 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Luis,

We looked into the issue and found that the problem is caused by data binding. We created a test app like this:

Code: HTML/ASPX
<asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>
<eo:Callback runat="server" ID="Callback1"></eo:Callback>
<asp:UpdatePanel runat="server" ID="UpdatePanel1">
    <ContentTemplate>
        <asp:GridView runat="server" ID="GridView1" AutoGenerateColumns="False" OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>abc</ItemTemplate>
                    <EditItemTemplate>
                        <eo:DatePicker runat="server" ID="DatePicker1" ControlSkinID="None" DayCellHeight="16" DayCellWidth="19" DayHeaderFormat="FirstLetter" DisabledDates="" OtherMonthDayVisible="True" SelectedDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" TitleRightArrowImageUrl="DefaultSubMenuIcon" VisibleDate="2007-07-01">
                            <TodayStyle CssText="border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
                            <PickerStyle CssText="font-family:Courier New; padding-left:5px; padding-right: 5px;" />
                            <SelectedDayStyle CssText="background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                            <DisabledDayStyle CssText="color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                            <CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
                            <TitleArrowStyle CssText="cursor:hand" />
                            <DayHoverStyle CssText="border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
                            <MonthStyle CssText="font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px; font-family: tahoma" />
                            <TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
                            <OtherMonthDayStyle CssText="color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                            <DayHeaderStyle CssText="border-bottom: #aca899 1px solid" />
                            <DayStyle CssText="border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                        </eo:DatePicker>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowEditButton="True" />
            </Columns>
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>


Code: C#
protected void Page_Load(object sender, EventArgs e)
{
    FillGrid();
}

private void FillGrid()
{
    GridView1.DataSource = new object[2];
    GridView1.DataBind();
}

protected void GridView1_RowEditing(
    object sender, GridViewEditEventArgs e)
{
    GridView1.EditIndex = e.NewEditIndex;
    FillGrid();
}
protected void GridView1_RowUpdating(
    object sender, GridViewUpdateEventArgs e)
{
    EO.Web.DatePicker picker = (EO.Web.DatePicker)
        GridView1.Rows[e.RowIndex].FindControl("DatePicker1");
    DateTime dt = picker.SelectedDate;
    System.Diagnostics.Debug.WriteLine(dt.ToString());
}


The code above demonstrates the problem. We then traced into the code and noticed that when you click "Update" to submit the change, the following happens:

1. ASP.NET creates the page based on the .aspx file;
2. ASP.NET loads view state/control state for the GridView. At this stage it re-creates the DatePicker control based on the column's EditTemplate since it sees the row is in editing mode based on view state date;
3. ASP.NET continues to load view state/control state for the child controls of the GridView. This includes the DatePicker. So the date you selected is filled into the DatePicker now. At this time the DatePicker has the correct value;
4. ASP.NET calls Page_Load;
5. Page_Load calls FillGrid. At this stage, the DatePicker control is being recreated, thus it loses the correct value that it has acquired in step 3;

Obviously, in order to avoid this problem, you should avoid step 5. The best way is to change:

Code: C#
protected void Page_Load(object sender, EventArgs e)
{
    FillGrid();
}


To:
Code: C#
protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
        FillGrid();
}


The problem no longer occurs once we made this change in our test app. Please let us know if this is the same scenario as yours.

Thanks
Luis German
Posted: Friday, August 3, 2007 2:41:25 PM
Rank: Newbie
Groups: Member

Joined: 6/7/2007
Posts: 6
Hi,

the continuous problem following its indications the rare thing is that if we cleared the UpdatePanel to him DateTime Picker works correctly
eo_support
Posted: Friday, August 3, 2007 2:53:24 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Luis,

Have you tried the code we provided in the previous post? That code has UpdatePanel and it works fine. Also we have thoroughly explained why our code works and why yours did not. Our controls are behaving as expected in both scenarios. So you might want to compare the working version and the non-working version to locate the difference first. If you can not find the difference, then we will need you to make a reproducing app for us so that we can take a look.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.