[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 538
  • Last Modified:

Customizing the search textbox

Hello,
I have a textbox for searching the site and would like to put the magnifying glass, which by the time now appears beside it, within it like Telerik's website (www.telerik.com).
This is the code for search Textbox:
<asp:TextBox ID="txtSearch" runat="server" onFocus="if(this.value=='Search...')this.value='';"
            onBlur="if(this.value == '')this.value='Search...';" Text="&nbsp;&nbsp;Search..."
         EnableViewState="False"></asp:TextBox>
And one of or both of these codes for the magnifying glass, which appears beside the textbox:
<div id="SearchIcon" class="SearchIcon" onclick="document.getElementById('SearchChoices').style.display='block'">
            <asp:Image ID="downArrow" runat="server" ImageUrl="~/images/action.gif" />
OR:
<asp:LinkButton ID="cmdSearch" runat="server" CausesValidation="False"></asp:LinkButton>
This is a DotNetNuke site.
Thanks
0
ihbemd6rb
Asked:
ihbemd6rb
  • 3
  • 2
1 Solution
 
Christian de BellefeuilleProgrammerCommented:
I would use an ImageButton instead of a LinkButton.
0
 
Christian de BellefeuilleProgrammerCommented:
In fact, if you look at Telerik site, the button is not INSIDE the textbox... it's just at the right of the textbox.  
(Type AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA in the box, you will see what i mean)

They probably use CssClass or Style to make it look like they want.

Here's a Textbox with a strange background under the textbox...  you might give it a try.
<asp:TextBox ID="UserName" runat="server"  style="font-size:larger; color:white; padding-top:13px; text-align:center;background-image:url(/Secure/images/obj_username.jpg);z-index:2; width:188px; height:45px; background-repeat:no-repeat" BackColor="Transparent" BorderWidth="0px" Height="45px" Width="188px"></asp:TextBox>
0
 
ihbemd6rbAuthor Commented:
Hello, I know that it is a background image, I also have  such a background image, but it doesn't work on click! On Telerik's website the people click on this background image to search, and it works. But mine does nothing!
Thanks
0
 
Christian de BellefeuilleProgrammerCommented:
As i said, use an ImageButton instead of a LinkButton like this:

    <asp:ImageButton ID="ImageButton1" runat="server" OnClick="CodeBehindFunction"  />

Of course, CodeBehindFunction, is your search code...
0
 
ihbemd6rbAuthor Commented:
Good idea! Thanks!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now