|
Rank: Member Groups: Member
Joined: 3/9/2009 Posts: 25
|
Hi,
I have a server control which when runs create a menu in a grid. The first time it runs everything is fine BUT when the page is looped (it is wrapped in a callback panel) it no longer continues to fire. I believe the line causing the issue is
obj.Attributes.Add("onmousedown", "parent." & Page.ClientScript.GetPostBackEventReference(obj, "") & ";")
But to be honest I have no idea what I can change this too!! Any ideas would be greatly appreciated. I have looked around the forums but apart from a reference to RenderClientScript I cant find anything.
Thanks
Steve
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Is your "obj" inside the CallbackPanel? CallbackPanel won't update anything outside of the CallbackPanel.
RenderClientScript is for a different purpose. That does not appear to what you need.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 3/9/2009 Posts: 25
|
Wow that was quick :-) Yes I have a user control inside a callback panel and inside the user control is a datagrid with the menu in. Everything else is working 100% apart from this menu click. First time I go into the page it is ok but if I click refresh (which does the ajax style refresh) it no longer fires although it still shows ok.
Steve
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We can't think of anything except for something related to the target control has changed, for example, when obj's ID changed, the event code that uses the old ID won't be fired. As a simple test, you can try to move your code into a separate function. For example:
obj.Attributes.Add("onmousedown", "test()");
You can then add a "test" JavaScript function in your code and see if that function is called. If the function is called everytime, then it has to do with your Page.ClientScript.GetPostBackEventReference. The next step you can try to disable all CallbackPanels (by clearing its Triggers) or completely remove them. If you still have the same problem, then the problem is obviously somewhere in your code.
If your test function not called during Callback, or Page.ClientScript.GetPostBackEventReference works without CallbackPanel but stops working with CallbackPanel, please create a test page that demonstrates the problem and we will be happy to take a look. Please make sure you isolate the problem into a test page (or several pages) that can run independently first, do not post your code as is. We won't be able to look into it if we can not run and see the problem here.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 3/9/2009 Posts: 25
|
will do. Thanks for your time
Steve
|
|
Rank: Member Groups: Member
Joined: 3/9/2009 Posts: 25
|
As I small update the issue is Page.ClientScript.GetPostBackEventReference inside the callbackpanel. Javascript does still fire for a test fuction and everything is 100% ok if I remove the callbackpanels?
Any ideas how I can get around this or if I can prove it is it a bug? The reason I ask is it will take me a number of days to repro the bug.
cheers guys
Steve
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, As long as your test function fires, you can move pretty much everything into your test function so that the code no longer has anything to do with the CallbackPanel and that should lead to a valid workaround. We do need a repro in order to look into an issue. We need that not just to "prove it is a bug". The most important reason is that if it is a bug, we need it in order to see the problem and also verify whatever fix we come up indeed fix the problem for you. Otherwise we would be shooting in the dark and we'd rather not to do that. Please see this post for more details: http://www.essentialobjects.com/forum/postst3013_I-run-into-a-problem-can-I-send-over-my-code-so-that-you-can-take-a-look.aspxThanks!
|
|