[RESOLVED] UpdatePanel works strange
Dear experts,
I have an UpdatePanel and some controls within it, as you can see below. If I change a number in txtGoToPage textbox and press Enter, GoToPage_TextChanged() event handler is called. But if I enter first any page number other than 1, press Enter, and then enter number 1 again, after pressing Enter GoToPage_TextChanged() is not called. The same problem exists with ddlPageSize dropdown list. As you can see, by default the third item is selected. If I select another item, ddlPageSize_SelectedIndexChanged() is called, but if after that I select the third (initially selected) item, ddlPageSize_SelectedIndexChanged() is not called.
Could you please help me fix that?
Thanks.
Code:
<asp:UpdatePanel ID="upnlLicensing" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
...
<asp:Label ID="Label1" runat="server" Text="Show rows:" />
<asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="true"
OnSelectedIndexChanged="ddlPageSize_SelectedIndexChanged">
<asp:ListItem Value="20" />
<asp:ListItem Value="50" />
<asp:ListItem Value="100" Selected="True" />
</asp:DropDownList>
Page
<asp:TextBox ID="txtGoToPage" runat="server" AutoPostBack="true"
OnTextChanged="GoToPage_TextChanged" CssClass="gotopage" onchange="JSSetSessionValue('ReloadLicensing', true);JSSetSessionValue('NewPageNumber', this.value)" />
of
<asp:Label ID="lblTotalNumberOfPages" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
Re: UpdatePanel works strange
Okay a few things..
With a ASP textbox, If you enter the same info that was in the box in the first place it does not trigger the change events.. (ASP applications have a different set of rules to Desktop applications).. and the same goes for DDL's if you select the same item that was set as default, a changed event does not trigger...
A work around is to normally add a "[Please Select one]" item to the DDL and set it as default, and clear the Textbox, every time the page loads..
Re: UpdatePanel works strange
Thank you for your answer. But my problem was not that that I was trying to trigger an event without making any change. The default value was selected (or entered in case of textbox) originally, but not immediately before the currently selected value, so a change has taken place.
And everything worked before I added UpdatePanel.
But I found the solution:
http://stackoverflow.com/questions/1...in-updatepanel
Re: UpdatePanel works strange
Cool .. Dont forget to mark this thread resolved....
Re: UpdatePanel works strange
May I ask how I can mark this thread as resolved?
Thanks.
Re: UpdatePanel works strange
Quote:
Originally Posted by
dpreznik
May I ask how I can mark this thread as resolved?
Thanks.
Just above the first post .. Thread Tools -> Mark thread Resolved...
Cheers ..