Knowledgebase Home Page  >  SearchUnit
Search the Knowledge Base
How to set categories checkbox dynamically and checked by default
https://keyoti.com/kb/Default.aspx?ToDo=view&questId=252&catId=54

Options

Print this page
Email this to a friend

You can set categories checkbox dynamically and checked by default.

With the following markup;

 

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

    <SearchEngineP:SearchBoxOptions ID="SearchBoxOptions1" runat="server" SearchBoxId="SearchBox1" Locations="" AutoGenerateContentCheckBoxes=false AutoGenerateLocationDropDown=false>

    </SearchEngineP:SearchBoxOptions>

 

 

you can do this in codebehind

 

    protected void Page_Load(object sender, EventArgs e)

    {

        SearchBoxOptions1.Contents.Add(new Keyoti.SearchEngine.Web.Design.StringItem("c1"));

        SearchBoxOptions1.Contents.Add(new Keyoti.SearchEngine.Web.Design.StringItem("c2"));

        (SearchBoxOptions1.ContentCheckBoxes.Controls[0] as CheckBox).Checked = true;

    }

 

this will add c1 and c2 content option check boxes and check the first checkbox (c1).

 

 


Related Questions:

Attachments:

No attachments were found.