|
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GalleryServerPro.Web.Controls
{
/// <summary>
/// A user control that provides search functionality in a popup window.
/// </summary>
public partial class search : GalleryUserControl
{
#region Protected Events
/// <summary>
/// Handles the Load event of the Page control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void Page_Load(object sender, EventArgs e)
{
RegisterJavascript();
}
/// <summary>
/// Handles the Click event of the btnSearch control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void btnSearch_Click(object sender, EventArgs e)
{
// Get reference to the Search textbox.
TextBox txtSearch = (TextBox)this.GalleryPage.FindControlRecursive(dgSearch, "txtSearch");
Util.Redirect(PageId.search, String.Format("aid={0}&search={1}", this.GalleryPage.GetAlbum().Id, Util.UrlEncode(txtSearch.Text)));
}
#endregion
#region Private Methods
private void RegisterJavascript()
{
if (this.GalleryPage.ShowSearch)
{
// Get reference to the UserName textbox.
TextBox txtSearch = (TextBox)this.GalleryPage.FindControlRecursive(dgSearch, "txtSearch");
string script = String.Format(@"
function toggleSearch()
{{
if (typeof(dgLogin) !== 'undefined')
dgLogin.close();
if (dgSearch.get_isShowing())
dgSearch.close();
else
dgSearch.show();
}}
function dgSearch_OnShow()
{{
$get('{0}').focus();
}}", txtSearch.ClientID);
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "searchFocusScript", script, true);
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I have nearly 20 years of industry experience in software development, architecture, and Microsoft Office products. My company
Tech Info Systems provides custom software development services for corporations, governments, and other organizations. Tech Info Systems is a registered member of the Microsoft Partner Program and I am a Microsoft Certified Professional Developer (MCPD).
I am the creator and lead developer of
Gallery Server Pro, a free, open source ASP.NET gallery for sharing photos, video, audio, documents, and other files over the web. It has been developed over several years and has involved thousands of hours. The end result is a robust, configurable, and professional grade gallery that can be integrated into your web site, whether you are a large corporation, small business, professional photographer, or a local church.