I've got many LinkButtons inside a repeater when I manually click on them, they post well All of my attempts to click on the link button via javascript have failed, and now the IM is going to be considered (and such a Google, no other option is available). I have tried to alternate between OnClick and OnCommand.
Linkbutton:
& amp; Asp: Repeater id = "repItems" runat = "server" OnItemDataBound = "repItems_OnItemDataBound" & gt; & Lt; ItemTemplate & gt; & Lt; Asp: panel id = "pnlItem" runat = "server" & gt; & Lt; Asp: LinkButton id = "lnkItem" runat = "server" OnClick = "lnkItem_OnClick" OnCommand = "lnkItem_OnCommand" & gt; & Lt; / ASP: Linkbutton & gt; & Lt; / ASP: Cell & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: Repeater & gt; Javascript:
eval (linkbutton.attr ('href'); // Reason sys.ParameterCountException LinkButton.click (); // anything (No click event on LinkButton) LinkButton.trigger ('click'); // Similar to LinkButton.click () If I set OnClientClick to postback , Then click () function starts working, but I get the Sys.ParameterCountException error:
lnkItem.OnClientClick = String.Format ("__ doPostBack ('{0}', ' '); ", LnkItem.UniqueID); Some people have used the script manager to release the mode It has suggested change, but it did not trigger a postback, it just deleted the error message.
eval (LinkButton.attr ('href'); In Google Chrome Works
I'm not sure. Are you running this issue in me, but for me The following works
ASCX:
& lt; ASP:. Repeat id = "repItems" runat = "server" & gt; & Gt; ItemMatePlat & gt; & Lt; Asp: panel id = "pnlItem" runat = "server" & gt; & Lt; ASP: LinkButton id = "lnkItem" runat = "server" text = '& lt;% # Eval ("text")% & gt; Onclick = "lnkItem_OnClick" OnCommand = "lnkItem_OnCommand" & gt; & Lt; / ASP: LinkButton & gt; & Lt; / ASP: Cell & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: Repeater & gt; & Lt; Button onclick = "document.getElementById ('MainContent_repItems_lnkItem_0'). Click (); Return false;" & Gt; Huzah! & Lt; / Button & gt; codebehind:
Protected Zero Page_Load (Object Sender, EventArgs e) {From the list & lt; Item & gt; Trial = new list & lt; Items & gt; (); Test.Add (new item {text = "item1"}); Test.Add (new item {text = "item 2"}); RepItems.DataSource = test; RepItems.DataBind (); } Protected Zero lnkItem_OnClick (Object Sender, EventArgs e) {this.Controls.Add (New Textual ()} {Text = ((LinkButton Sender) .text}); } Zero lnkItem_OnCommand (object sender, EventArgs e) {this.Controls.Add (new verbal ()} {text = ((LinkButton Sender) .text}) remains secure; } Both OnClick and OnCommand fire in this example.
Comments
Post a Comment