using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using Microsoft.SharePoint.Portal.WebControls; namespace MyNameSpace { /// /// Override of the default search control /// public class SearchBox : SearchBoxEx { /// /// Override the default rendering of the controlscollection, it calls the base first and /// then it gets the different controls from the table. The table is set to invisible. /// protected override void CreateChildControls( ) { base.CreateChildControls( ); if ( Controls.Count < 2 ) { return; } HyperLinkLoc hlink = null; if ( Controls[ 1 ].GetType( ) == typeof ( Table ) ) { Table tabel = ( Table ) Controls[ 1 ]; // Loop through cells to find the go button foreach ( TableCell cell in tabel.Rows[ 0 ].Cells ) { if ( cell.Controls.Count > 0 ) { if ( cell.Controls[ 0 ].GetType( ) == typeof ( HyperLinkLoc ) ) { hlink = ( HyperLinkLoc ) cell.Controls[ 0 ]; } } } tabel.Visible = false; //add new controls if ( m_searchKeyWordTextBox != null ) { HtmlGenericControl div = new HtmlGenericControl( "div" ); div.Attributes.Add( "class", "ms-sbcell" ); m_searchKeyWordTextBox.Style.Clear( ); // remove the width style, done in css div.Controls.Add( m_searchKeyWordTextBox ); Controls.Add( div ); } if ( hlink != null ) { HtmlGenericControl div3 = new HtmlGenericControl( "div" ); div3.Attributes.Add( "class", "ms-sbgo ms-sbcell" ); div3.Controls.Add( hlink ); Controls.Add( div3 ); } if ( m_ddlScopes != null ) { HtmlGenericControl div2 = new HtmlGenericControl( "div" ); div2.Attributes.Add( "class", "ms-sbscopes ms-sbcell" ); div2.Controls.Add( m_ddlScopes ); Controls.Add( div2 ); } } } } }