jtcy
asked on
ASP.NET: ImageButton to open New Window
I have this:
<asp:ImageButton ID="imbJoin" CssClass="btn-find" AlternateText="Find" ToolTip="Find" runat="server" ImageUrl="~/library/btn-fi nd.gif" onClick="javascript:popUp( 'ServicesL ocator.asp x')" />
and when running, it says:
Compiler Error Message: CS1012: Too many characters in character literal
<asp:ImageButton ID="imbJoin" CssClass="btn-find" AlternateText="Find" ToolTip="Find" runat="server" ImageUrl="~/library/btn-fi
and when running, it says:
Compiler Error Message: CS1012: Too many characters in character literal
ASKER
But then how would it know what function to call? The function name is PopUp
I'm sorry I should have been more specific.. Everything that you have done is correct except the single quotes within the javascript call, Your asp:button call should be this:
<asp:ImageButton ID="imbJoin" CssClass="btn-find" AlternateText="Find" ToolTip="Find" runat="server" ImageUrl="~/library/btn-fi nd.gif" onClick="javascript:popUp( "ServicesL ocator.asp x")" />
<asp:ImageButton ID="imbJoin" CssClass="btn-find" AlternateText="Find" ToolTip="Find" runat="server" ImageUrl="~/library/btn-fi
@jtcy: what's in the popUp function?
you might need to change your code behind as...
imbJoin.Attributes.Add("on click", "popUp('ServicesLocator.as px');" )
and remove
onClick="javascript:popUp( 'ServicesL ocator.asp x')"
you might need to change your code behind as...
imbJoin.Attributes.Add("on
and remove
onClick="javascript:popUp(
ASKER
The thing is, I dont want it to do a postback (refresh).
then just use an HTML image button not a server-side button.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
In C# or vb using single quotesonly for chars or a s ingle character you need double quotes for strings.