Wednesday, March 28, 2012

Share DropDownExtender for several LinkButtons

Hello mister,

I have an UpdatePanel , and several LinkButtons.

I want one DDE control for associated this linkbuttons using TargetControlID property dynamically if is possible.

The code:





TargetControlID="DYNAMIC ********************* ?????????"


<asp:PanelID="PanelOrdenacionTareasAsignadas"runat="server"CssClass="ContextMenuPanel"Style="display :none; visibility: hidden;">



<asp:LinkButtonID="linkTipoTarea"Text="Tipo Tarea"runat="server"CommandArgument='tipotarea'></asp:LinkButton>

When I click one of them, I want show DropDownExtender but How I set TargetControlID property ??

Any help, please ? I will be very grateful for any comments for this issue, thanks in advance. Greetings. Regards.

Hi Alhambraeidos,

When click on the different LinkButton, the same DropDownExtender will be shown with different content in diffent position. Do you want this functionlity? If I have misunderstood, please feel free to let me know.

As far as I know, there is no set_targetControlID(value) has been exposed yet. So we cannot dynamically change its TargetControlID on the client side unless we send back and do it on the server side. This not met your requirements.

Fortunately, after a long time work. I found a way and provided the sample below.

In this sample , I have three LinkButtons and a DropDownExtender. One of the LinkButtons is set to be hidden at first. So there are only two LinkButtons shown on the page. When the mouse move on the LinkButton, the Hidden LinkButton will be show by being moved to a proper position. The Hidden one will cover the orignal.

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""><script runat="server"></script><html xmlns=""><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager><asp:LinkButton ID="LinkButton1" runat="server" style="display:none">LinkButton</asp:LinkButton> <br /> <br /> <asp:Panel ID="Panel1" runat="server" style="display:none"> 123123123<br> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </asp:Panel> <ajaxToolkit:DropDownExtender ID="DropDownExtender1" BehaviorID="myDDEBID" runat="server" TargetControlID="LinkButton1" DropDownControlID="Panel1"> </ajaxToolkit:DropDownExtender> <asp:LinkButton ID="LinkButton2" runat="server" OnClientClick="return false;" onmouseover="showDDE('LinkButton2','LinkButton2');">LinkButton2</asp:LinkButton> <asp:LinkButton ID="LinkButton3" runat="server" OnClientClick="return false;" onmouseover="showDDE('LinkButton3','LinkButton3');">LinkButton3</asp:LinkButton><%=DateTime.Now.ToString()%> <script type="text/javascript" language="javascript"> function showDDE(lbName,lbText){ //If you want to change the Panel's content when switch from different LinkButtons , the easiest way is to add an UpdatePanel inside the Panel. //When onhover event is fire, first refresh the UpdatePanel by sending an asynchronous postback.var newLocation = $common.getLocation($get(lbName)); $get("LinkButton1").innerText = lbText; //if Firefox , $get("LinkButton1").textContent = lbText; $common.setLocation($find("myDDEBID").get_element(),new Sys.UI.Point(newLocation.x ,newLocation.y)); $get("LinkButton1").style.display=''; $find("myDDEBID").hide(); //enhance the compatibility $find("myDDEBID").hover(); } </script> </form></body></html>

We suggest that you should wholly copy it to a blank page and have a test.

Hope this help.

Best regards,


Share my Atlas web Template

hi all, i have create my site using my Atlas Web template (it called "only html web template" or "offline web"). you can download and use it .


My site is VietNamese, and hard to understand. Sorry.

It atlas site so i dont have the direct link for you, please click Projects on the right bar, then clickOnly Html Web Template to get info and down the source.

I thank to any suggest from you (Sorry my English)

Contact me if you have any problem with this template or any bug of it.

Thank all.

Hi, sorry if i'm spaming ^_^. But my site doesnt support FF at this time ^^. But, the template is correct in 2 web browser.

Share single Popup Control from Multiple ModalPopupExtender with Multiple Target Control

Hi, recently I had a situation where I need to popup the same Modal Popup Panel from two different buttons(Target Controls). So I hooked two different modalpopupextenders to the two buttons with same popup control. It dosen't work. Is it a bug or its not working by design? Any suggestion?

Like this modification to ControlToolkit's ModalPopup Sample

<asp:LinkButton ID="LinkButton1" runat="server" Text="Click here to change the paragraph style" />
<asp:LinkButton ID="LinkButton2" runat="server" Text="Click here 2 to change the paragraph style" />
<asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup">
<asp:Panel ID="Panel3" runat="server" Style="cursor: move;background-color:#DDDDDD;border:solid 1px Gray;color:Black">
<p>Choose the paragraph style you would like:</p>
<input type="radio" name="Radio" id="RadioA" checked="checked"
onclick="styleToSelect = 'sampleStyleA';" />
<label for="RadioA" class="sampleStyleA"
style="padding: 3px;">Sample paragraph text</label>
<input type="radio" name="Radio" id="RadioB"
onclick="styleToSelect = 'sampleStyleB';" />
<label for="RadioB" class="sampleStyleB"
style="padding: 3px;">Sample paragraph text</label>
<input type="radio" name="Radio" id="RadioC"
onclick="styleToSelect = 'sampleStyleC';" />
<label for="RadioC" class="sampleStyleC"
style="padding: 3px;">Sample paragraph text</label>
<input type="radio" name="Radio" id="RadioD"
onclick="styleToSelect = 'sampleStyleD';" />
<label for="RadioD" class="sampleStyleD"
style="padding: 3px;">Sample paragraph text</label>
<p style="text-align: center;">
<asp:Button ID="OkButton" runat="server" Text="OK" />
<asp:Button ID="CancelButton" runat="server" Text="Cancel" />
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender2" runat="server"



I suggest you use javascript to show the modal popup for the second linkbutton. And only one instance of ModalPopupExtender is required.

<asp:LinkButton ID="LinkButton2" runat="server"OnClientClick="$find('test1').show(); return false;"Text="Click here 2 to change the paragraph style" />

Share your experience with


I have question in mind that why we need I am working on VS 2005 or Net 2.0 . If I download it on my machine It will effect to my old projects which are in .net 2.0 not

I have seen in this forum that so many user post the bug in I am really confused ! I want to learn this new tech. but I am afraid that if I download it or it will be effect to my old projects.

Please suggest me and show me the right path.

Thanks in advance

Hi Kunal,

If you are referring about Microsoft AJAX Library and ASP.NET 2.0 AJAX Extensions, well, they dont affect your existing projects. They are just add-ins to your Visual Studio 2005 project templates.

When you install them, you get an option while creating websites as "ASP.NET AJAX Enabled Website"

This would enable you to use Microsoft AJAX Library and ASP.NET 2.0 AJAX Extensions controls such as UpdatePanel, etc.,which help you in accomplish intuitive web pages.

Having said that, they are in Beta and they dont affect any of the existing projects.

Hope this clarifies.



well, i think it's ok to say that your old projects are safe. there are still a few bugs in the current release., but i think that the current versions are usable in real world applications

Thanks all of you for replies.

I have one more question in mind that If I will make Ajax Enabled website using VS 2005. then I will upload it on online server.

then what is the requirment of online server.

Online server must have Framework?

Hi Kunal,

Yes currently you would need to install the Ajax Framework in the Server.

The reason being, it has been shipped as an add-in to the existing Visual Studio and ASP.NET and a major release which is going to happen shortly will cover this issue and you wont need to explicitly install the same on the server.

Currently, yes, you need to install it manually.

Think of this as your .NET Framework needed to be installed on the deployment server.


Sharepoint 2007 and AJAX


Does anyone have experience using parts from the AJAX Toolkit in sharepoint 2007. Especially I need to get PageMethods to work in order to do callbacks to server side code. And yes, I have set EnablePageMethods="true" in the scriptmanager which is set in the master page. I get a PageMethods is undefined javascripterror.

Anyone who has a solution for this?

Are your PageMethods defined within the ASPX page? If it's in a user control or something, this won't work. I would recommend trying to use standard web service calls instead of PageMethods if you are going to integrate the code with Sharepoint; see for more info.


Thank you for your reply. My PageMethods are within a user control. I'll try using webservice calls instead.

SharePoint meets Ajax

I posted on this board a while ago to find out how to get Ajax to work on SharePoint pages and WebParts. I never really got it to work properly.

Since WSS 3.0 final was released last month I'd like to know wether there's some official solution out? I didn't find any working examples on this or other boards/newsgroups.

Currently I have two things to accomplish:

1) simple JS UI that uses the ASP Ajax libs to dynamically display dialogs etc.

2) loading data from a DB into a gridview via ajax


Try to take a look at this reading about using Ajax.NET Pro in a SharePoint Web Part -

Try to take a look at this reading about Using SharePoint and AJAX to Gather Website Feedback -

Wish the above can help you.

SharePoint Web Parts and Atlas?

I'm turning to Atlas as my last hope to find a way of using AJAX with SharePoint web parts.

Unfortunately, I'm already losing heart. I just created a website using the Atlas template, and I see a Default.aspx with an Atlas-oriented server control in it:


<formid="form1"runat="server"> <atlas:ScriptManagerID="ScriptManager1"runat="server"/>

This does not bode well. This is a web part, which is in a web part zone in a web part page with which I have no design-time access. I don't have the luxury of dropping server controls into my page at design time.

Can anyone tell me what, exactly, I have to do to make Atlas work? All I want to do is to be able to have my client-side code be able to make server-side calls, and to receive data from the server back to the client-side callback. I don't care about AJAX-enabled controls, and I don't want to use markup-style AJAX. I just want to be able to "roll my own" functions both client- and server-side.

If there's a way around this ScriptManager stuff, then maybe using Atlas and web parts is actually possible...I need one of you Atlas gurus to tell me that, though.

Thanks very much!


well, i'm not a sharepoint user, but i was under the assumption that it works only under 1.x. if this is the case, you will only be able to use the client side components of atlas...

True that SharePoint itself only works under ASP.NET 1.x, but I'm actually using only VS.NET 2005. All SharePoint web parts I've written to date are Framework 2.0 class libraries, and all work fine.


well, the problem is that the site that has the dll must be configured to use 2.0. that's needed because the scriptmanager class uses the webresource.axd to get the js files needed on the client side.


Sorry, I'm mistaken. The default website under our WSS instanceis running 2.0. I'm not sure why that works, but it does.

Any ideas on how my web part could be made to work, then?


hum...not sure about sharepoint web parts. what i can tell you is that currently, if you're using 2.0 web parts, everything must be placed inside the same updatepanel (including the zones and the webpartmanager control)...