Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Linkbutton in Repeater in AJAX Update panel

Reply
Thread Tools

Linkbutton in Repeater in AJAX Update panel

 
 
milop
Guest
Posts: n/a
 
      03-21-2009
Hello.

Using ASP.Net 2.0 and an AJAX Enabled web application, I have a Repeater
control on a page with two ImageButton columns and a LinkButton column.

I have an UpdatePanel on the page with UpdateMode set to Conditional. The
trigger is the Repeater control.

Clicking either of the ImageButtons works as expected. When I click the
LinkButton the first time, it works as expected. Clicking it again results
in the browser displaying the "Stop running this script ..." message.

I'm not doing anything special with the LinkButton properties or
code-behind, so I don't know what the heck is going on.

I resorted to removing the LinkButton and using an asp:Button with a style
that makes it look like a link.

Any ideas anyone?

Thanks in advance,

Mike


 
Reply With Quote
 
 
 
 
Dawid Rutyna
Guest
Posts: n/a
 
      03-23-2009
(...)
> Clicking either of the ImageButtons works as expected. When I click the
> LinkButton the first time, it works as expected. Clicking it again results
> in the browser displaying the "Stop running this script ..." message.

(...)

I had no such problem using Framework 3.5. My code:

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<Person> persons = new List<Person>();
persons.Add(new Person("AName", "ASurname", "ANick"));
persons.Add(new Person("BName", "BSurname", "BNick"));
persons.Add(new Person("CName", "CSurname", "CNick"));
Repeater1.DataSource = persons;
Repeater1.DataBind();
}
}

protected void UpdatePanel1_Load(object sender, EventArgs e)
{
Label1.Text = string.Concat("Time: ",
DateTime.Now.ToLongTimeString());
}
}



<%@ Page Language="C#" EnableEventValidation="true" AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<html>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="Scriptmanager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server"
UpdateMode="Conditional" OnLoad="UpdatePanel1_Load">
<Triggers>
<aspostBackTrigger ControlID="Repeater1" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<asp:Button ID="Button1" runat="server"
Text='<%#DataBinder.Eval(Container.DataItem, "Name")%>' />
<asp:Button ID="Button2" runat="server"
Text='<%#DataBinder.Eval(Container.DataItem, "Surname")%>' />
<asp:LinkButton ID="LinkButton1" runat="server" Text='<%#
"[" + DataBinder.Eval(Container.DataItem, "Nick") + "]" %>' />
<br />
</ItemTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>


Dawid Rutyna


 
Reply With Quote
 
 
 
 
milop
Guest
Posts: n/a
 
      03-24-2009
Perhaps 3.5 corrected something.

I'll give it a shot with VS 2008.

Thank Dawid.

"Dawid Rutyna" <(E-Mail Removed)> wrote in message
news:gq7404$e20$(E-Mail Removed)...
> (...)
>> Clicking either of the ImageButtons works as expected. When I click the
>> LinkButton the first time, it works as expected. Clicking it again
>> results in the browser displaying the "Stop running this script ..."
>> message.

> (...)
>
> I had no such problem using Framework 3.5. My code:
>
> public partial class _Default : System.Web.UI.Page
> {
> protected void Page_Load(object sender, EventArgs e)
> {
> if (!IsPostBack)
> {
> List<Person> persons = new List<Person>();
> persons.Add(new Person("AName", "ASurname", "ANick"));
> persons.Add(new Person("BName", "BSurname", "BNick"));
> persons.Add(new Person("CName", "CSurname", "CNick"));
> Repeater1.DataSource = persons;
> Repeater1.DataBind();
> }
> }
>
> protected void UpdatePanel1_Load(object sender, EventArgs e)
> {
> Label1.Text = string.Concat("Time: ",
> DateTime.Now.ToLongTimeString());
> }
> }
>
>
>
> <%@ Page Language="C#" EnableEventValidation="true" AutoEventWireup="true"
> CodeFile="Default.aspx.cs"
> Inherits="_Default" %>
> <html>
> <body>
> <form id="form1" runat="server">
> <asp:ScriptManager ID="Scriptmanager1" runat="server">
> </asp:ScriptManager>
> <div>
> <asp:UpdatePanel ID="UpdatePanel1" runat="server"
> UpdateMode="Conditional" OnLoad="UpdatePanel1_Load">
> <Triggers>
> <aspostBackTrigger ControlID="Repeater1" />
> </Triggers>
> <ContentTemplate>
> <asp:Label ID="Label1" runat="server"
> Text="Label"></asp:Label>
> </ContentTemplate>
> </asp:UpdatePanel>
> <asp:Repeater ID="Repeater1" runat="server">
> <ItemTemplate>
> <asp:Button ID="Button1" runat="server"
> Text='<%#DataBinder.Eval(Container.DataItem, "Name")%>' />
> <asp:Button ID="Button2" runat="server"
> Text='<%#DataBinder.Eval(Container.DataItem, "Surname")%>' />
> <asp:LinkButton ID="LinkButton1" runat="server" Text='<%#
> "[" + DataBinder.Eval(Container.DataItem, "Nick") + "]" %>' />
> <br />
> </ItemTemplate>
> </asp:Repeater>
> </div>
> </form>
> </body>
> </html>
>
>
> Dawid Rutyna
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ajax update panel trigger =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 2 10-07-2006 01:49 AM
datalist and ajax update panel =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 2 10-02-2006 07:31 PM
[ATLAS] Unknown error ON Update Panel + Repeater with LinkButton Henrique ASP .Net 1 09-12-2006 04:31 PM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net 3 09-08-2005 09:41 AM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net Datagrid Control 1 09-08-2005 08:44 AM



Advertisments