Showing posts with label linkbutton. Show all posts
Showing posts with label linkbutton. Show all posts

Monday, March 26, 2012

Dydfunctional behavior of the control HoverMeuExtender

Hi

With the ajax control HoverMenuExtender
i have a problem.


After have launch the page in Internet Explorer
with the onmouseover event on the linkbutton (as opportunely setted)
appears the popup.


The dydfunctional behavior is that
justlaunch the page,
little moments after than it opens the tab,
all the popups relative at the controls HoverMeuExtender
they open for some moments and then they close.
The effect isunpleasant.

Happen at you too?

Here are some sample codes about ajax:HoverMenuExtender for your reference.
<div>
<ul>
<li>
<asp:LinkButton runat="server" id="lnkParent" text="Parent Menu Item"/>
</li>
<asp:panel runat="server" id="pnlChild">
<ul>
<li>Child Item 1</li>
<li>Child Item 2</li>
</ul>
</asp:panel>
<ajax:HoverMenuExtender ID="hoverMenu"
PopupControlID="pnlChild"
TargetControlID="lnkParent"
PopupPosition="Bottom"
runat="server" />
</ul>
</div>
Wish the above can help you.

Dyanmically created linkbuttons, within UpdatePanel, is not working

Hello Folks,

I am updating a placeholder, to create some form controls, from my code behind.

I am successful. Now, I want to create a linkbutton, next to each form control i create, that when clicked on, go to the same generic event and read the control's ID (passed by the linkbutton somehow) and then I will do the logic to remove the control from the placeholder. Right now it creates the linkbuttons, but to ensure i don't have duplicate ID's, I add a unique int.tostring on the end of the ID of the linkbuttons. And I added the handler that should send all clicks, from all the linkbuttons to the same event. But I put a breakpoint in that event and when I click any of the linkbuttons, it just refreshes and no change to the page and the breakpoint in the event is never reached. Please let me know if you have any ideas, questions.. a portion of my code, with notes, below...

I am able to create all form elements except buttons, link buttons, etc.

I think the link button creation should be as simple as:

victorylinkBTN.ID ="victorylinkBTN" & VictoryReplicantCount.ToString

AddHandler victorylinkBTN.Click,AddressOf victorylinkBTN_Click

DCP.Controls.Add(victorylinkBTN)

victorylinkBTN.Text ="Del"

Dim vicEventAsNew System.EventArgs()

Is that right? It does create the linkbuttons, but the click fails. It submits, but nothing happens, it just refreshes with nothing changed, and doesn't land on my breakpoint, in the sub below.

Sub victorylinkBTN_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)

Dim linkbutAs LinkButton =CType(sender, LinkButton)

Dim linkbutIDAsString = linkbut.ID.ToString

'do more work……

EndSub

If you have any idea what I am doing wrong, please let me know.

Also, if you have experience with update panels, if I make the update panel conditional, then how would I set each of these linkbuttons to have trigger rights to the related update panel?

Again, thanks for any help ...

Folks,

I have found a cheesy way to do this, by adding javascript on each linkButton created that inserts the linkButton ID into a hidden field's value on the page and then on that linkButton submit, in pageLoad, I read the value of the hidden field to decide to perform the action.

This works, and would take some serious time to explain. Please feel free to email me via the forum contact ability, if you want details.

I am leaving this open, hoping someone in the asp.net team will have a better solution.


Since you dynamically add thelink buttons, you should add it to the PlaceHolder in the Page_Load event every time instead of adding it just the page first load. Because when you only add it the first time the page load, after post back, thelink buttonswill disappear. And itdoesn't land on your breakpoint invictorylinkBTN_Click,There is non victorylinkBTN when your postback.

Try this:

publicpartialclassDefault2 : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

AddControl(PlaceHolder_ContentRight,"~/WebUserControl.ascx",true);

}

privatevoid AddControl(PlaceHolder PlaceHolder,string ControlPath,bool Clear)

{

Control Control_ToAdd;

Control_ToAdd = LoadControl(ControlPath);

if (Clear)

{

PlaceHolder.Controls.Clear();

}

PlaceHolder.Controls.Add(Control_ToAdd);

}

}

If this help you,don't forget mark it as a answer.Thanks!

Best Regards

Jin-Yu Yin

Wednesday, March 21, 2012

DropDownExtender LinkButton doesnt work

I am currently using a DropDownExtender to provide a SharePoint like experience with a drop down on a link button. This seems to work fine in IE7, but when I get to IE6, clicking on the LinkButton will activate the drop down (rather than firing the LinkButton's Click event). I've posted the pertinent code below. Thanks for any help!

Mike

<asp:LinkButton Style="padding-right: 25px; display: block; padding-left: 2px; padding-bottom: 2px;
padding-top: 2px;" ID="NameLink" runat="server" Text='<%# Bind("Name") %>'
Enabled='<%# Bind("HasChildren") %>' OnClick="NameLink_Click" CommandArgument='<%# Eval("ComponentIndex") %>'></asp:LinkButton>

<asp:Panel Style="display: none; visibility: hidden" ID="NameOptions"
runat="server">
<table>
<tbody>
<tr>
<td style="width: 6px">
<asp:Image ID="Image2" runat="server" ImageUrl="~/ReportTool/images/AddToPage.bmp"></asp:Image></td>
<td>
<asp:LinkButton ID="PropertiesLink" OnClick="EditProperties_Click" runat="server"
CommandArgument='<%# Eval("ComponentIndex") %>' Enabled='<%# Eval("Editable") %>'>Properties</asp:LinkButton></td>
</tr>
<tr>
<td style="width: 6px">
<asp:Image ID="Image3" runat="server" ImageUrl="~/ReportTool/images/delete_16x.ico">
</asp:Image></td>
<td>
<asp:LinkButton ID="RemoveLink" OnClick="RemoveLink_Click" runat="server" CommandArgument='<%# Eval("ComponentIndex") %>'
Enabled='<%# Eval("Removeable") %>'>Remove</asp:LinkButton></td>
</tr>
<tr>
<td style="width: 6px">
</td>
<td>
<asp:LinkButton ID="MoveItemButton" runat="server" CommandArgument='<%# Eval("ComponentIndex") %>'
Enabled='<%# Eval("Moveable") %>' OnClick="MoveItemButton_Click">Move Item</asp:LinkButton></td>
</tr>
<tr>
<td style="width: 6px">
</td>
<td>
<asp:LinkButton ID="SequenceItemButton" runat="server" CommandArgument='<%# Eval("ComponentIndex") %>'
Enabled='<%# Eval("Sequenceable") %>' OnClick="SeqItemButton_Click">Sequence Item</asp:LinkButton></td>
</tr>
<tr>
<td style="width: 6px">
</td>
<td>
<asp:LinkButton ID="StyleButton" runat="server" CommandArgument='<%# Eval("ComponentIndex") %>'
Enabled='<%# Eval("Styleable") %>' OnClick="StyleButton_Click">Style</asp:LinkButton></td>
</tr>
</tbody>
</table>
</asp:Panel>
<cc1:DropDownExtender ID="DropDownExtender1" runat="server" TargetControlID="NameLink"
HighlightBackColor="wheat" DropDownControlID="NameOptions">
</cc1:DropDownExtender>

Hi,

I tried it on IE 6 with following code, the click event is successfully fired.

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"> protected void OnSelect(object sender, EventArgs e) { } protected void TextLabel_Click(object sender, EventArgs e) { Response.Write("fired"); }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:LinkButton ID="TextLabel" Text="Select your favorite exotic ice-cream flavor" runat="server" Style="display: block; width: 300px; padding:2px; padding-right: 50px; font-family: Tahoma; font-size: 11px;" OnClick="TextLabel_Click">LinkButton</asp:LinkButton> <asp:Panel ID="DropPanel" runat="server" CssClass="ContextMenuPanel" Style="display :none; visibility: hidden;"> <asp:LinkButton runat="server" ID="Option1" Text="Mocha Blast" CssClass="ContextMenuItem" OnClick="OnSelect" /> <asp:LinkButton runat="server" ID="Option2" Text="Java Cyclone" CssClass="ContextMenuItem" OnClick="OnSelect" /> <asp:LinkButton runat="server" ID="Option3" Text="Dry Fruit" CssClass="ContextMenuItem" OnClick="OnSelect" /> </asp:Panel> <ajaxToolkit:DropDownExtender runat="server" ID="DDE" DropArrowImageUrl="../images/arrowvf2.gif" TargetControlID="TextLabel" DropDownControlID="DropPanel" /> <br /> </div> </form></body></html>

Can you update to the most recent version of AjaxControlToolkit and try again.

If it still doesn't work, can you post a simple page here? It seems you are using it in a GridView control, can you change the sample to use NorthingWind database?


Hi Raymond, Thank you for your reply!

I first loaded the update ajaxcontroltoolkit. That changed things so that link was getting clicking but then I couldn't activate the drop down. I then noticed that you had "width: 300px" and I wasn't specifying a width. After I added that, all is ok.

Now if only I can get it to work onFirefox ...

Mike


But it works on Firefox too according to my test.