|
-
Apr 12th, 2011, 10:10 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Button Behavior changes?????
HI all,
This is a strange one. I have 2 image buttons. One is for sorting, the other opens a panel with a button in it to do filtering.
If I click the image button to filter, choose my filter criteria, then click the button to do the actual filtering everything works great.
Likewise, if I click the image button to sort everything works great.
HOWEVER, After filtering 5 times in a row successfully (or however many times, the count is irrelevant), then I sort, all of a sudden the image button to filter won't fire.
Both buttons that trigger an action are in an asp:updatepanel.
Code:
<asp:AsyncPostBackTrigger
ControlID="ibtnSortName" />
<asp:AsyncPostBackTrigger
ControlID="btnFilterName" />
ibtnSortName fires the sort routine and btnFilterName firest the filter routine.
Here's the code that contains those buttons:
Code:
<td class="50PctNoBorderRight">
<asp:ImageButton
ID="ibtnFilterName"
runat="server"
ImageUrl="~/images/filter.png"
AlternateText="Filter Name"
OnClientClick="return false;" />
<asp:Panel ID="pnlFilterName"
runat="server"
CssClass="FilterPopupControl" >
Select the Specific Name You Wish To View
<br />
<asp:ListBox
ID="lstName"
runat="server"
SelectionMode="Multiple"
CssClass="HomeFilter">
</asp:ListBox>
<br />
<asp:ImageButton
ID="btnFilterName"
runat="server"
OnClick="btnFilterName_Click"
ImageUrl="~/images/buttons/btn_submit.png" />
</asp:Panel>
<asp:ImageButton
ID="ibtnSortName"
runat="server"
ImageUrl="~/images/sort_asc2.png"
onclick="ibtnSortName_Click"
AlternateText="Sort Name" />
</td>
And here's the popup control extender i use to display the filter area:
Code:
<asp:PopupControlExtender
ID="pceFilterName"
runat="server"
TargetControlID="ibtnFilterName"
PopupControlID="pnlFilterName"
Position="Bottom"
CommitProperty="value">
</asp:PopupControlExtender>
The bizarre behavior I can't figure out is that the ibtnSortName ALWAYS works and fires the code behind. The btnFilterName stops firing the code behind only after I click the ibtnSortName. If I never sort, the btnFilterName always works.
I've looked at the html source to see if anything is different ( I sorted then resorted so the order would be exactly the same) and the HTML is exactly the same in both the pre-sorted and post-sorted iterations.
Anyone have any ideas? If it were just that the code behind were not acting properly, I could easily fix this. But the code behind just stops getting triggered?
Thanks,
Jon
-
Apr 25th, 2011, 06:44 AM
#2
Re: Button Behavior changes?????
Hello,
Does the same thing happen in different browsers? Or is it only on one particular browser?
Gar
-
Apr 25th, 2011, 06:55 AM
#3
Thread Starter
Hyperactive Member
Re: Button Behavior changes?????
 Originally Posted by gep13
Hello,
Does the same thing happen in different browsers? Or is it only on one particular browser?
Gar
I tried it in Chrome and an interesting result. The filter logic doesn't work at all, even if I try it first as opposed to trying the sort logic first. Plus I noticed on another screen that the popupcontrol extender from the ajax control toolkit doesn't work as expected.
-
Apr 25th, 2011, 06:56 AM
#4
Thread Starter
Hyperactive Member
Re: Button Behavior changes?????
Same thing in Firfox. Is this yet another IE quirk?
-
Apr 25th, 2011, 06:59 AM
#5
Thread Starter
Hyperactive Member
Re: Button Behavior changes?????
Even more bizarre, now the filter logic doesn't work at ll even in IE and nothing changed
-
Apr 25th, 2011, 07:04 AM
#6
Re: Button Behavior changes?????
Oh, wow, that is very weird!
Are you seeing any JavaScript errors on the page?
Gary
-
Apr 25th, 2011, 07:42 AM
#7
Thread Starter
Hyperactive Member
Re: Button Behavior changes?????
-
Apr 25th, 2011, 01:43 PM
#8
Thread Starter
Hyperactive Member
Re: Button Behavior changes?????
Some additional information that may or may not be helpful. When I referesh in IE8, the buttons work again.
-
Apr 25th, 2011, 10:48 PM
#9
Re: Button Behavior changes?????
Try removing them from the updatepanel (all the relevant controls) does it work?
If so then the problem is your updatepanel.It tends to leave iexplorer do stuff but other browsers may want more "strict" declarations.
Btw if you use JS for your buttons then why do you need an updatepanel?Your can either use an HTMLButton or return a "false" in your js function.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Apr 26th, 2011, 06:44 AM
#10
Thread Starter
Hyperactive Member
Re: Button Behavior changes?????
 Originally Posted by sapator
Try removing them from the updatepanel (all the relevant controls) does it work?
If so then the problem is your updatepanel.It tends to leave iexplorer do stuff but other browsers may want more "strict" declarations.
Btw if you use JS for your buttons then why do you need an updatepanel?Your can either use an HTMLButton or return a "false" in your js function.
I was hoping to display a "Waiting..." image whenever a button was clicked on the page itself. So all of the content is contained within an update panel.
Seems like this may not be an option though. Once I got rid of the update panel everything is working as expected.
So much for Microsoft's solutions
-
Apr 26th, 2011, 06:55 AM
#11
Re: Button Behavior changes?????
Looks like another reason to not use UpdatePanel, I have a collection of them now 
Gary
-
Apr 26th, 2011, 06:56 AM
#12
Re: Button Behavior changes?????
Looks like another reason to not use UpdatePanel, I have a collection of them now 
Gary
-
Apr 26th, 2011, 09:13 AM
#13
Thread Starter
Hyperactive Member
Re: Button Behavior changes?????
But why would a refresh of the browser cause it to work again? I don;t understand the logic behind that.
-
Apr 26th, 2011, 09:33 AM
#14
Thread Starter
Hyperactive Member
Re: Button Behavior changes?????
And it's odd that it's not just IE that has this issue. The same thing is occurring in Firefox as well
-
Apr 26th, 2011, 10:04 AM
#15
Thread Starter
Hyperactive Member
Re: Button Behavior changes?????
OK Maybe this will help. I opened up the page in Firefox with Firebug. Without doing a browser refresh, here's a section of code as it appears at the end of the page (this is from the firebug script view)
Code:
<span id="ctl00_MainForm_ShipmentDisplay_lblUserNotifications" class="tooltipPopup"><div><strong>User Notifications</strong></div><div><p>The following Notifications have occurred within the past 30 days</p></div>No notifications found.</span>
|0|hiddenField|__LASTFOCUS||0|hiddenField|__EVENTTARGET||0|hiddenField|__EVENTARGUMENT||32856|hiddenField|__VIEWSTATE|/wEPDwUKLTUyMDA1...... (shortened to fit the post)...... =|1530|asyncPostBackControlIDs||ctl00$MainForm$ShipmentDisplay$ibtnSortTrackingReference,,ctl00$MainForm$ShipmentDisplay$ibtnSortShipperName,,ctl00$MainForm$ShipmentDisplay$btnFilterSCACCode,,ctl00$MainForm$ShipmentDisplay$btnFilterShipperName,,ctl00$,|49|postBackControlIDs||ctl00$MainForm$ShipmentDisplay$ibtnExportToExcel,|46|updatePanelIDs||tctl00$MainForm$ShipmentDisplay$upnlShipments,|0|childUpdatePanelIDs|||45|panelsToRefreshIDs||ctl00$MainForm$ShipmentDisplay$upnlShipments,|5|asyncPostBackTimeout||36000|9|formAction||Home.aspx|135|scriptBlock|ScriptPath|/TrackingWebsite/Home.aspx?_TSM_HiddenField_=ctl00_MainForm_ShipmentDisplay_ToolkitScriptManager1_HiddenField&_TSM_CombinedScripts_=%3b|382|scriptStartupBlock|ScriptContentNoTags|Sys.Application.add_init(function() {
$create(Sys.Extended.UI.PopupControlBehavior, {"CommitProperty":"value","PopupControlID":"ctl00_MainForm_ShipmentDisplay_pnlFilterSCACCode","Position":3,"dynamicServicePath":"/TrackingWebsite/Home.aspx","id":"ctl00_MainForm_ShipmentDisplay_pceFilterSCACCode"}, null, null, $get("ctl00_MainForm_ShipmentDisplay_ibtnFilterSCACCode"));
});
But when I do a refresh and look at firebug, I get this:
Code:
<span id="ctl00_MainForm_ShipmentDisplay_lblUserNotifications" class="tooltipPopup"><div><strong>User Notifications</strong></div><div><p>The following Notifications have occurred within the past 30 days</p></div>No notifications found.</span>
</div>
<div id="ctl00_UpdateProgress1" style="display:none;">
<div class="UpdateOverlay" id="divProgress">
<img src="images/loading_animated.gif" alt="Loading, please wait..." />
</div>
</div>
</div>
<script type="text/javascript">
//<![CDATA[
(function() {var fn = function() {$get("ctl00_MainForm_ShipmentDisplay_ToolkitScriptManager1_HiddenField").value = '';Sys.Application.remove_init(fn);};Sys.Application.add_init(fn);})();WebForm_AutoFocus('ctl00_MainForm_ShipmentDisplay_txtSearch');Sys.Application.add_init(function() {
$create(Sys.Extended.UI.PopupControlBehavior, {"CommitProperty":"value","PopupControlID":"ctl00_MainForm_ShipmentDisplay_pnlFilterSCACCode","Position":3,"dynamicServicePath":"/TrackingWebsite/Home.aspx","id":"ctl00_MainForm_ShipmentDisplay_pceFilterSCACCode"}, null, null, $get("ctl00_MainForm_ShipmentDisplay_ibtnFilterSCACCode"));
});
I don;t get it. What am I missing? The initial load is creating a garbage set of code that doesn't work, yet the browser refresh fixes it. What am I doing wrong here?
-
Apr 26th, 2011, 11:08 AM
#16
Thread Starter
Hyperactive Member
Re: Button Behavior changes?????
OK here's what appears to have solved the problem.
The ajaxtoolkit:PopupControlExtender seems to be the cause of the problem. I went back and removed the control and replaced it with the ajaxtoolkit:ModalPopupExtender. This will require me to reformat my control slightly for the filter, but now it works every time (so far anyway).
Thanks to all who responded, hopefully someone will find this useful.
-
Apr 26th, 2011, 06:17 PM
#17
Re: [RESOLVED] Button Behavior changes?????
Btw you can display a waiting...image without putting EVERYTHING on the updatepanel(i assume you used updateprogress ?), just the button.
Of course you can get in serious trouble with validation extenders and you must use js (i was talking with brin on another thread for this).
You can also exclude the updatepanel and use js on the button that triggers the waiting.
But ok don't go bash on the UpdatePanel (Gary ) at once when a problem pops out.As a matter of fact, displaying a waiting image with update extenders is one thing that it actually works on the damn thing! 
EDIT:Forgot to say that a refresh could make it work maybe because some page loading stage has to be loaded first but it happens on another loading stage.So when you refresh the cache, may be already there and make your page work.
You can try removing the cache and you may find that it will no longer work even on a refresh.This is hypothetical though, by seeing your data output.It may be another reason but i think it's a page circle problem.
Last edited by sapator; Apr 26th, 2011 at 06:29 PM.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Apr 26th, 2011, 06:29 PM
#18
Thread Starter
Hyperactive Member
Re: [RESOLVED] Button Behavior changes?????
I've got 26 buttons on the page (gotta love user requirements! ) that's why they are all inside the update panel.
-
Apr 26th, 2011, 06:30 PM
#19
Thread Starter
Hyperactive Member
Re: [RESOLVED] Button Behavior changes?????
I've got 26 buttons that affect the data ( gotta love user requirements ). That's why they are all in the update panel.
-
Apr 26th, 2011, 06:30 PM
#20
Re: [RESOLVED] Button Behavior changes?????
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Apr 27th, 2011, 01:25 AM
#21
Re: [RESOLVED] Button Behavior changes?????
You got gotta love users and their crazy ideas!! But, it's them that pays the bills, so we can't live without them 
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|