#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    1
    Rep Power
    0

    Searchbox doesn't work on HomePage


    Dear all,

    I'm a newbie to Asp.net. Here is my website: nicegesture.com

    The problem is the searchbox at header (right at the navigation menu) doesn't work just only at HomePage.

    It works on all of the page except homepage. When click search at homepage, it doesn't submit anything and also not redirect to search page. There's a weird thing is it's working perfect at local host even for homepage, but not on the real server.

    I've been spending 1 week finding a solution for it but it comes to nothing. Please give me an advice for this. I really appreciate it. Thank you.

    Here's some of the code:

    Home.master

    <form id="form1" runat="server">

    <uc3:AdminPanel ID="AdminPanel1" runat="server"></uc3:AdminPanel>
    <div id="outwrap">
    <div id="wrap">
    <uc1:Header ID="Header1" runat="server" />

    Header.ascx

    <uc4:SearchBox ID="SearchBox1" runat="server"></uc4:SearchBox>

    And here's the code of Search Control:

    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="Search.ascx.vb" Inherits="BVModules_Controls_Search" %>
    <div class="searchboxform">
    <strong><span><asp:Label ID="lblTitle" runat="server" Text="Search" AssociatedControlID="KeywordField" Visible="false"></asp:Label></span></strong>
    <asp:Panel runat="server" DefaultButton="btnSearch" ID="pnlSearchBox">
    <span class="searchspan">
    <asp:TextBox ID="KeywordField" Columns="35" runat="server" CssClass="forminput"></asp:TextBox>
    <asp:ImageButton CausesValidation="false" CssClass="searchbutton" ID="btnSearch" runat="server"/>
    </span>
    </asp:Panel>
    </div>

    And here's is the code behind search control:

    Imports BVSoftware.Bvc5.Core

    Partial Class BVModules_Controls_Search
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
    SetDefaultControlValues()
    End If
    End Sub

    Private Sub SetDefaultControlValues()
    lblTitle.Text = Content.SiteTerms.GetTerm("Search")
    btnSearch.ImageUrl = PersonalizationServices.GetThemedButton("GoSearch")
    btnSearch.AlternateText = "Submit Form"
    End Sub

    Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSearch.Click
    Response.Redirect("~/search.aspx?keyword=" & Server.UrlEncode(Me.KeywordField.Text.Trim))
    End Sub

    End Class
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,439
    Rep Power
    4539
    Please use the forum CODE tags around posted code. I don't use NET and don't have any suggestions about your problem, sorry. If no one jumps in you might try the NET forum, this forum is primarily classic asp.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester

IMN logo majestic logo threadwatch logo seochat tools logo