Showing posts with label autopostback. Show all posts
Showing posts with label autopostback. Show all posts

Saturday, March 24, 2012

UpdatePanel and AutoPostback

I have a textbox with AutoPostback set to true to fire an OnTextChanged event. This worked until I put the textbox inside an UpdatePanel and now it doesn't fire the event. Why is that?

Thanks

Sounds odd, I have a repeater where I have a TextBox and the TextChanged event fires to potentially show more controls based on the record being changed. I have it wrapped in an update panel and it works fine.

<asp:ScriptManagerProxyID="ScriptManagerProxy1"runat="server">

</asp:ScriptManagerProxy>

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<ContentTemplate>

<asp:UpdateProgressID="UpdateProgress1"runat="server">

<ProgressTemplate>

Updating...</ProgressTemplate>

</asp:UpdateProgress>

'''''Stuff goes here, like tables and my repeater, etc.

<asp:TextBoxID="txtQty"runat="server"Width="35"AutoPostBack="true"OnTextChanged="txtQty_TextChanged"></asp:TextBox>

'''''Stuff goes here, like tables and my repeater, etc.

</ContentTemplate>

</asp:UpdatePanel>

ProtectedSub txtQty_TextChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)

'Event Handler Guts go here

Me.SetFocus(txtQty.UniqueID)

Next

EndSub


Are you sure the event isn't firing (did you check in the debugger)? If the actions of your OnTextChanged event handler don't act on an UpdatePanel that's updating in the resulting partial postback, you aren't going to see anything happen. So, if you just wrapped that TextBox in an UpdatePanel and nothing else, it would appear that it stopped working.

Wednesday, March 21, 2012

UpdatePanel and RadioButtons

I have a series of RadioButton controls, each with a unique ID, each set to AutoPostBack, followed by an UpdatePanel with a set of event triggers, one for each RadioButton control, aimed at the "CheckedChanged" event. The RadioButton controls all belong to the same group and the first RadioButton is set to Checked true.

Clicking all but the first RadioButton causes the UpdatePanel to update, as expected. However, clicking the first RadioButton does nothing. If I remove the Checked="true" attribute from the first RadioButton, I get the desired behavior.

This is with July CTP.

-MT

This problem is still present in AJAX Beta1!

-MT


I think that your radio button list is outside the update panel. If that is the case, than the issue you have mentioned is by design.
Note that on an async post, only the controls which are inside the update panel gets updated. The radio button list is outside the update panel and hence it wont get updated.

What you can do instead is put the radio button list inside another update panel and set the UpdateMode of that updatepanel to conditional.
This would ensure that the radio button list is updated on every checkchange event.

vineetc


vineetc:

I think that your radio button list is outside the update panel. If that is the case, than the issue you have mentioned is by design.
Note that on an async post, only the controls which are inside the update panel gets updated. The radio button list is outside the update panel and hence it wont get updated.

What you can do instead is put the radio button list inside another update panel and set the UpdateMode of that updatepanel to conditional.
This would ensure that the radio button list is updated on every checkchange event.

vineetc

Vineetc, thank you for sounding in. I am pretty sure you are describing a different scenario. What I described should work (and, for the most part, does). I think there is a bug with handling a radiobutton that is set from the beginning.

-MT


Can you post the code

vineetc


vineetc,

This may be an old post but your solution worked great for me. Thanks.