Page 1 of 1

Converting Search LinkButton to ImageButton doesn't work

Posted: Tue Sep 15, 2009 4:29 pm
by ZLA
In CategorySearchSideBar.ascx, the keyword button is defined as follows:

Code: Select all

<asp:LinkButton ID="KeywordButton" runat="server" Text="Go" CssClass="searchButton" 
SkinId="ignore" EnableViewState="False" />
Our design uses an image instead of a formatted link so I tried the following:

Code: Select all

<asp:ImageButton ID="KeywordButton" runat="server" Text="Go" CssClass="searchButton"
SkinId="ignore" EnableViewState="False" 
ImageUrl="~/App_Themes/StorkGiftsBrown/images/pink-go-button.jpg" 
/>
When I do this, the page posts back but nothing happens. This is because on postback, the Imagebutton produces an empty value for eventTarget in PageInit routine. So NarrowByKeyword never gets called. I also tried it with EnableViewState="True" but that made no difference either.

Can someone tell me what I'm doing wrong? Changing linkbuttons to imagebuttons elsewhere worked fine. It's just on this page that it seems to fail. Thanks in advance.

Re: Converting Search LinkButton to ImageButton doesn't work

Posted: Tue Sep 15, 2009 5:16 pm
by ZLA
Realized other conversions used explicit OnClick event whereas this control doesn't. So I did the following instead which worked fine:

Code: Select all

<asp:LinkButton ID="KeywordButton" runat="server" Text="" CssClass="searchButton" SkinId="ignore" 
      EnableViewState="False" >
   <img id="KeywordButtonImage" runat="server" 
      src="~/App_Themes/StorkGiftsBrown/images/pink-go-button.jpg" />
</asp:LinkButton>