D:\NorthwindForWeb\Northwind\CS\DotNet\ADO.Net\Northwind\WebControls\LookupWCCBase.cs
/*
* This file was generated by ProCG version 2.0
*
* File name: Northwind\WebControls\LookupWCCBase.cs
* Language: C# - ADO.Net
* Database: My Sql
*
* Copyright (c) 2002-2019 iGenXSoft.
* For more information visit http://www.igenxsoft.com
*/
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using Northwind.General;
using Northwind.Data;
using Northwind.WebControls;
namespace Northwind.WebControls
{
/// <summary>
/// Summary description for LookupWCC.
/// </summary>
[DefaultProperty("Value"),
ToolboxData("<lt>{0}:LookupWCCBase runat=server><lt>/{0}:LookupWCCBase>")]
public class LookupWCCBase : WebCustomControlWCC
{
public bool ShowCode
{
get
{
if (this.ViewState["ShowCode"] != null)
return (bool)this.ViewState["ShowCode"];
else
return true;
}
set
{
this.ViewState["ShowCode"] = value;
}
}
public bool ShowCodeWhenReadOnly
{
get
{
if (this.ViewState["ShowCodeWhenReadOnly"] != null)
return (bool)this.ViewState["ShowCodeWhenReadOnly"];
else
return false;
}
set
{
this.ViewState["ShowCodeWhenReadOnly"] = value;
}
}
public bool ShowBrowseImage
{
get
{
if (this.ViewState["ShowBrowseImage"] != null)
return (bool)this.ViewState["ShowBrowseImage"];
else
return true;
}
set
{
this.ViewState["ShowBrowseImage"] = value;
}
}
public string ChooseURL
{
get
{
if (this.ViewState["ChooseURL"] != null)
return (string)this.ViewState["ChooseURL"];
else
return "";
}
set
{
this.ViewState["ChooseURL"] = value;
}
}
public int ChooseWindowWidth
{
get
{
if (this.ViewState["ChooseWindowWidth"] != null)
return (int)this.ViewState["ChooseWindowWidth"];
else
return 0;
}
set
{
this.ViewState["ChooseWindowWidth"] = value;
}
}
public int ChooseWindowHeight
{
get
{
if (this.ViewState["ChooseWindowHeight"] != null)
return (int)this.ViewState["ChooseWindowHeight"];
else
return 0;
}
set
{
this.ViewState["ChooseWindowHeight"] = value;
}
}
protected override void CreateChildControls()
{
if (this.FieldShowMode == FieldShowModeEnum.SHOW_NORMAL)
{
//System.Web.UI.UpdatePanel updatePanel = new UpdatePanel();
//updatePanel.ID = "updatePanel";
if (ShowBrowseImage)
{
Label label3 = new System.Web.UI.WebControls.Label();
label3.Text = " ";
this.Controls.Add(label3);
System.Web.UI.WebControls.ImageButton imageButton = new System.Web.UI.WebControls.ImageButton();
imageButton.ID = "ChooseImageButton";
imageButton.CssClass = "ChooseImageButton";
this.Controls.Add(imageButton);
imageButton.ImageUrl = NorthwindGeneral.GetWebImagesURL(this.Page.Theme) + "search.png";
imageButton.ToolTip = "Choose from list";
imageButton.Width = 20;
imageButton.Height = 20;
//string javaScript = "javascript:ChooseElement('" + NorthwindGeneral.GetWebServerRootURL() + ChooseURL + "'," + textCode.ClientID + "," + descriptionLabel.ClientID + ");return false;";
//imageButton.Attributes.Add("onclick", javaScript);
System.Web.UI.WebControls.Label label1 = new System.Web.UI.WebControls.Label();
label1.Text = " ";
this.Controls.Add(label1);
}
System.Web.UI.WebControls.TextBox textCode = null;
textCode = new System.Web.UI.WebControls.TextBox();
textCode.ID = "Code";
int numPixels = NorthwindWebEnv.GetNumPixelsFromChars(3);
textCode.Attributes["style"] = "width:" + numPixels + "px";
textCode.CssClass = "TextBoxCss";
this.Controls.Add(textCode);
System.Web.UI.WebControls.Label label = new System.Web.UI.WebControls.Label();
label.Text = " ";
this.Controls.Add(label);
if (!ShowCode)
{
textCode.CssClass = "hidden";
label.Visible = false;
System.Web.UI.WebControls.Label label2 = new System.Web.UI.WebControls.Label();
label2.Text = " ";
this.Controls.Add(label2);
}
System.Web.UI.WebControls.Label descriptionLabel = new System.Web.UI.WebControls.Label();
descriptionLabel.ID = "Description";
descriptionLabel.CssClass = "TextBoxCss Disabled";
this.Controls.Add(descriptionLabel);
if (textCode != null)
{
//textCode.TextChanged += new EventHandler(textCode_TextChanged);
textCode.AutoPostBack = true;
}
//this.Controls.Add(updatePanel);
}
else if (FieldShowMode == FieldShowModeEnum.SHOW_READ_ONLY)
{
if (ShowCodeWhenReadOnly)
{
System.Web.UI.WebControls.TextBox textCode = NorthwindWebEnv.CreateTextBox();
textCode.ID = "Code";
int numPixels = NorthwindWebEnv.GetNumPixelsFromChars(3);
textCode.Attributes["style"] = "width:" + numPixels + "px";
textCode.CssClass = "TextBoxCss Disabled";
this.Controls.Add(textCode);
textCode.ReadOnly = true;
textCode.ID = "Code";
System.Web.UI.WebControls.Label label = new System.Web.UI.WebControls.Label();
label.Text = " ";
this.Controls.Add(label);
}
System.Web.UI.WebControls.Label descriptionUserId = new System.Web.UI.WebControls.Label();
this.Controls.Add(descriptionUserId);
descriptionUserId.ID = "Description";
descriptionUserId.CssClass = "TextBoxCss Disabled";
}
}
private void textCode_TextChanged(object sender, EventArgs e)
{
UpdateField(GetCurrentControlValue());
//WebEnv.SetControlValue(m_FieldNum);
}
protected override string GetCurrentControlValue()
{
string currentCode = string.Empty;
currentCode = CodeControl.Text;
return currentCode;
}
protected override void SetCurrentControlValue(string value)
{
if (CodeControl != null)
CodeControl.Text = value;
}
public TextBox CodeControl
{
get
{
EnsureChildControls();
return (TextBox)this.FindControl("Code");
}
}
public Label DescriptionControl
{
get
{
EnsureChildControls();
return (Label)this.FindControl("Description");
}
}
public ImageButton ChooseImageButton
{
get
{
EnsureChildControls();
return (ImageButton)this.FindControl("ChooseImageButton");
}
}
public void SetDynamicAttributes()
{
//string javaScript = "javascript:ChooseElement('" + NorthwindGeneral.GetWebServerRootURL() + ChooseURL + "'," + CodeControl.ClientID + "," + DescriptionControl.ClientID + ");return false;";
//ChooseImageButton.Attributes["onclick"] = javaScript;
}
protected override HtmlTextWriterTag TagKey
{
get
{
return HtmlTextWriterTag.Div;
}
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (ChooseImageButton != null) // not display only
{
string javaScript;
javaScript = "javascript:ChooseElement('" + NorthwindGeneral.GetWebServerRootURL() + ChooseURL + "', 'ChooseWindow', '" + CodeControl.ClientID + "', '" + DescriptionControl.ClientID + "'," + ChooseWindowHeight + "," + ChooseWindowWidth + ");return false;";
ChooseImageButton.Attributes["onclick"] = javaScript;
}
}
}
}
// 7519 ProCG uses this line - don't edit it