Showing posts with label document. Show all posts
Showing posts with label document. Show all posts

Saturday, March 24, 2012

Invoking postback for an update panel in a parent document

The default page for my website contains a div with links to user data that is only visible when a user is logged into my site. The login control lives in an IFrame within the default page (see sample code below).

Now, how can I get the udpate panel on the default page to recognize an event or a button click inside of the login control? I'm not looking for a tutorial on getting the login control to work, but rather any link button inside of the IFrame's update panel forcing the default page's update panel to post back. Both pages have a script manager.

chopped down version of existing code:

dafault page:

1<asp:update panel id="upUserPrefs" runat="server" updatemode="conditional">2 <contenttemplate>3 <div id="userPrefs" runat="server"><a href="prefs.aspx">preferences</a></div>4 </contenttemplate>5</asp:update panel>

IFrame source page:

1 <asp:UpdatePanel ID="updateSignon" runat="server" UpdateMode="conditional">2 <ContentTemplate>3 <asp:Table ID="tblLoginCtrl" runat="server" visible="false" Width="100%" HorizontalAlign="Left" CellPadding="0" CellSpacing="0">4 <asp:TableRow>5 <asp:TableCell ID="tcLoginCtrl">6 <uc1:LoginControl ID="LoginControl" Enable runat=server LoginStyle=Login_Home />7 </asp:TableCell>8 </asp:TableRow>9 </asp:Table>10 </ContentTemplate>11 </asp:UpdatePanel>
Any help would be greatly appreciated.

</p><p> (this.Parent.Parent as UpdatePanel).Update();</p><p>

is what I use.....however i have other problems...LOL. but that should fix yours.


Hi,

I think you can add a invisible button in the default page, set it as a trigger for the update panel.

Then add a javascript function in the contained page, in which invoke the click event of the button in the container.

Please feel free to let me know if there is any problem.


I tried that before, but when I have 2 instances of the same control on my page, it fires events for both of them. Or did I do something wrong?? Should this be happening? Have you ever heard of this??


In my opinion, it's normal that two control of the same type would behavior the same.

Wednesday, March 21, 2012

Is it possible to change the name of "$" function?

Hi all..

When ATLAS is used, client controls can be accessed using $(controlId) which is equivalent to document.getElementById(controlId). Unfortunately, I have other script in the same page that uses "$" as an internal variable, causing, obviously, confict.

Is there a way to change "$" function name. I tell you beforehand that it's impossible to make such a change to the other script (which is a third party commercial script).

Any help or suggestion would be greatly appreciated,

Thanks

Jaime

Well, the "$" is a javascript shortcut for document.getElementById (as you stated) and this would be a LOT more difficult to change than your 3rd party change, if it can even be changed at all

Really? so I am stuck then, because the third party script is very very big, and $ is being used intensively. It is used as part of other variables, part of other functions and alone. I would need to detect when it is used alone and replace only that entry. As you see, it will be very easy to make mistakes.

As you said, $ is a shortcut for document.getElementById, but it is not original from JavaScript, it was defined in WebResource.axd file by ATLAS assembly. That's why I was believing that it was possible to change before the page was rendered.

Jaime


Hi Jaime,

It might be possible to create a super function which contains the functionality for both of the "$" functions and intelligently switches logic based on the parameter passed in. For example, the Atlas function is only expecting a single parameter. If the function in your third party code is expecting more than one parameter, you might be in business. You can also check to see whether the type of parameter is different.

What does the "$" function in your third party framework do? Can you give a quick overview of the function prototype, what parameters it expects and what value it returns?

-Tony


The "$" defined in the other script isn't a function but a variable.

The script implements a very complete DHTML menu, so you can imagine how complex is the programming of it.

The direct effect this problem has over the execution of the page is that, in place of each menu options, several "function $(elementID) { return document.getElementById(elementID); }" appear. It seems that the third party script is using precisely variable "$" to render menu options.

Jaime


Ok, that makes things much more complicated. I would expect that the third party library would be a little easier to modify than Atlas though. See if you can do a simple search and replace on "$" in the script to replace it with something like "$$"

Hope this helps,
Tony


hello.

well, it seems like your javascript library is being inserted on the page before the atlas files. btw, if don't need to use the atlas controls and xml-script, then including only the runtime components will not define the $ function.

it also looks like you're inserting the menu file before the atlas file. if you change the order, then $ will have the "correct" value and atlas will work ok too since i think it doesn't use that method internally.