Friday, January 4, 2008

OnClientClick Eval confirmation message

I needed to add a parameter to the delete confirmation message I added to OnClientClick, but Eval(“Name”, “abc {0}”) does not appear to work in VB.Net, so I went old school and used DataBinder.Eval.  I know it’s fallen out of favor, but it WORKS!

 

<asp:TemplateField>

    <ItemTemplate>

        <asp:ImageButton ID="delete" runat="server" OnClientClick='<%#  DataBinder.Eval(Container.DataItem, "Name", "return confirm(""Are you sure you want to delete [{0}] ?"");")  %>'

            CommandName="Delete" AlternateText="Delete" ImageUrl="~/images/delete.gif" />

    </ItemTemplate>

</asp:TemplateField>

 

2 comments:

Anonymous said...

Who knows where to download XRumer 5.0 Palladium?
Help, please. All recommend this program to effectively advertise on the Internet, this is the best program!

Anonymous said...

Nice one ! :)