Arkiv för kategorin 'javascript'

Confirm javascript on .NET Linkbutton in datagrids

onsdag 21 maj, 2008 kl. 2:37 e m

Today I was struck with some really weird behaviour from a LinkButton in a Datagrid. I could not get the the confirm() javascript to fire. My code-behind was something like this:

LinkButton lb = ((LinkButton)dgItem.FindControl(”lb”));
lb.Attributes[”onClick”] = “return confirm(’Do you really want to do that?’);”;

I dont really know why the onClick confirm-box does not fire before the […]