本文整理汇总了C#中System.Web.UI.WebControls.Panel.FindControl方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.FindControl方法的具体用法?C# Panel.FindControl怎么用?C# Panel.FindControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Panel
的用法示例。
在下文中一共展示了Panel.FindControl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadSettings
private void LoadSettings()
{
AddClassToBody("registerpage");
siteAvailableSubscriptions = NewsletterHelper.GetAvailableNewslettersForSiteMembers(siteSettings.SiteGuid);
IncludeDescriptionInList = displaySettings.IncludeNewsletterDescriptionInList;
pnlSubscribe = (Panel)CreateUserWizardStep1.ContentTemplateContainer.FindControl("pnlSubscribe");
if (pnlSubscribe != null)
{
pnlSubscribe.Visible = displaySettings.ShowNewsLetters;
clNewsletters = (CheckBoxList)pnlSubscribe.FindControl("clNewsletters");
rbHtmlFormat = (RadioButton)pnlSubscribe.FindControl("rbHtmlFormat");
rbPlainText = (RadioButton)pnlSubscribe.FindControl("rbPlainText");
rbHtmlFormat.Text = Resource.NewsletterHtmlFormatLabel;
rbPlainText.Text = Resource.NewsletterPlainTextFormatLabel;
Label lblNewsletterListHeading = (Label)pnlSubscribe.FindControl("lblNewsletterListHeading");
lblNewsletterListHeading.Text = displaySettings.NewsletterListHeading.Coalesce(Resource.NewsletterPreferencesHeader);
// fix bug https://www.mojoportal.com/Forums/Thread.aspx?pageid=5&t=11390~1#post47409
if((IsPostBack)&&(clNewsletters.Items.Count == 0)) { pnlSubscribe.Visible = false;}
}
if (WebConfigSettings.AllowUserProfilePage)
{
string destinationUrl = WebConfigSettings.PageToRedirectToAfterRegistration;
if (destinationUrl.Length == 0) { destinationUrl = "/Secure/UserProfile.aspx"; }
this.RegisterUser.FinishDestinationPageUrl
= SiteRoot + destinationUrl;
this.RegisterUser.ContinueDestinationPageUrl
= SiteRoot + destinationUrl;
this.RegisterUser.EditProfileUrl = SiteRoot + "/Secure/UserProfile.aspx";
}
else
{
this.RegisterUser.FinishDestinationPageUrl = SiteRoot ;
this.RegisterUser.ContinueDestinationPageUrl = SiteRoot;
this.RegisterUser.EditProfileUrl = SiteRoot;
}
rpxApiKey = siteSettings.RpxNowApiKey;
rpxApplicationName = siteSettings.RpxNowApplicationName;
if (WebConfigSettings.UseOpenIdRpxSettingsFromWebConfig)
{
if (WebConfigSettings.OpenIdRpxApiKey.Length > 0)
{
rpxApiKey = WebConfigSettings.OpenIdRpxApiKey;
}
if (WebConfigSettings.OpenIdRpxApplicationName.Length > 0)
{
rpxApplicationName = WebConfigSettings.OpenIdRpxApplicationName;
}
}
//string returnUrlParam = Page.Request.Params.Get("returnurl");
//if (!String.IsNullOrEmpty(returnUrlParam))
//{
// string redirectUrl = Page.ResolveUrl(Page.Server.UrlDecode(returnUrlParam));
// this.RegisterUser.FinishDestinationPageUrl = redirectUrl;
// this.RegisterUser.ContinueDestinationPageUrl = redirectUrl;
//}
if (ViewState["returnurl"] != null)
{
this.RegisterUser.ContinueDestinationPageUrl = ViewState["returnurl"].ToString();
}
// only allow return urls that are relative or start with the site root
//http://www.mojoportal.com/Forums/Thread.aspx?thread=5314&mid=34&pageid=5&ItemID=2&pagenumber=1#post22121
if (Request.Params.Get("returnurl") != null)
{
//string returnUrlParam = Page.Request.Params.Get("returnurl");
//if (!String.IsNullOrEmpty(returnUrlParam))
//{
//returnUrlParam = SecurityHelper.RemoveMarkup(returnUrlParam);
string redirectUrl = SiteUtils.GetReturnUrlParam(Page, SiteRoot);
//string redirectUrl = Page.ResolveUrl(SecurityHelper.RemoveMarkup(Page.Server.UrlDecode(returnUrlParam)));
//if (redirectUrl.StartsWith("/")) { redirectUrl = SiteRoot + redirectUrl; }
//if (
// (redirectUrl.StartsWith(SiteRoot))
// || (redirectUrl.StartsWith(SiteRoot.Replace("https://", "http://")))
// )
//{
if (redirectUrl.Length > 0)
{
this.RegisterUser.ContinueDestinationPageUrl = redirectUrl;
}
//.........这里部分代码省略.........
示例2: SetPhotoCategories
/// <summary>
/// Set the photo categories
/// </summary>
/// <param name="imagePanel">The panel that contains the photo</param>
/// <returns></returns>
private async Task SetPhotoCategories(Panel imagePanel)
{
Image itemImage = (Image)imagePanel.FindControl("itemImage");
Image itemLoading = (Image)imagePanel.FindControl("itemWordsLoading");
Label itemWords = (Label)imagePanel.FindControl("itemWords");
itemLoading.Visible = false;
var item = ItemList.Where(i => i.URL.Equals(itemImage.ImageUrl)).FirstOrDefault();
if (item != null && string.IsNullOrEmpty(item.Words))
{
string[] tags = await ComputerVision.GetCategories(item.URL);
item.Words = StringUtils.ConvertStringArrayToString(tags);
itemWords.Text = item.Words;
}
if (item == null || String.IsNullOrEmpty(item.Words))
{
itemWords.Text = "Não foi possível obter as categorias da imagem";
}
}
示例3: SaveProperty
public static void SaveProperty(
SiteUser siteUser,
Panel parentControl,
mojoProfilePropertyDefinition propertyDefinition,
Double legacyTimeZoneOffset,
TimeZoneInfo timeZone)
{
String controlID;
Control control;
if (propertyDefinition.ISettingControlSrc.Length > 0)
{
controlID = "isc" + propertyDefinition.Name;
control = parentControl.FindControl(controlID);
if (control != null)
{
siteUser.SetProperty(
propertyDefinition.Name,
((ISettingControl)control).GetValue(),
propertyDefinition.SerializeAs,
propertyDefinition.LazyLoad);
}
}
else
{
switch (propertyDefinition.Type)
{
case "System.Boolean":
controlID = "chk" + propertyDefinition.Name;
control = parentControl.FindControl(controlID);
if (control != null)
{
siteUser.SetProperty(
propertyDefinition.Name,
((CheckBox)control).Checked,
propertyDefinition.SerializeAs,
propertyDefinition.LazyLoad);
}
break;
case "System.DateTime":
controlID = "dp" + propertyDefinition.Name;
control = parentControl.FindControl(controlID);
if (control != null)
{
DatePickerControl dp = (DatePickerControl)control;
if (dp.Text.Length > 0)
{
DateTime dt;
if (DateTime.TryParse(
dp.Text,
CultureInfo.CurrentCulture,
DateTimeStyles.AdjustToUniversal, out dt))
{
if (propertyDefinition.IncludeTimeForDate)
{
if (timeZone != null)
{
dt = dt.ToUtc(timeZone);
}
else
{
dt = dt.AddHours(-legacyTimeZoneOffset);
}
if (propertyDefinition.Name == "DateOfBirth")
{
siteUser.DateOfBirth = dt.Date;
siteUser.Save();
}
else
{
siteUser.SetProperty(
propertyDefinition.Name,
dt.ToString(),
propertyDefinition.SerializeAs,
propertyDefinition.LazyLoad);
}
}
else
{
if(propertyDefinition.Name == "DateOfBirth")
{
siteUser.DateOfBirth = dt.Date;
siteUser.Save();
}
else
{
siteUser.SetProperty(
propertyDefinition.Name,
dt.Date.ToShortDateString(),
propertyDefinition.SerializeAs,
//.........这里部分代码省略.........
示例4: DisplayNeueZutatentenListe
/// <summary>
/// Displays an empty Zutetenlist which is used when new Zutaten are added.
/// </summary>
/// <param name="rezeptAbteilungPanel"></param>
/// <param name="newestOnly">true when called form the AddZutaten OnClick event</param>
private void DisplayNeueZutatentenListe(Panel rezeptAbteilungPanel, bool newestOnly)
{
var eventtarget = Request.Params.Get("__EVENTTARGET"); //is null when a submit button is clicked or page is loaded without postback
var rezeptAbteilungPanelID = Helper.IsolateRezepAbteilungPanelIDFromEventtargetString(eventtarget);
var zutatenAnzahl = 0;
if (ViewState[rezeptAbteilungPanel.ID] != null)
zutatenAnzahl = (int) ViewState[rezeptAbteilungPanel.ID];
if(zutatenAnzahl == 0)
{
//ZutatenCounter für Rezeptabteilung erhöhen
zutatenAnzahl += 1;
ViewState[rezeptAbteilungPanel.ID] = zutatenAnzahl;
}
if (newestOnly)
{
//Bestehende neue Zutat und Rezeptabteilung Buttons entfernen - sonst steht die neue Zeile nach den Buttons
var neueZutatButton = rezeptAbteilungPanel.FindControl(Helper.REZEPBEARBEITEN_IDENT_NEUE_ZUTAT_BUTTON + rezeptAbteilungPanel.ID);
var neueRezeptAbteilungButton = rezeptAbteilungPanel.FindControl(Helper.REZEPBEARBEITEN_IDENT_NEUE_REZEPTABTEILUNG_BUTTON + rezeptAbteilungPanel.ID);
var neueZutatButtonLit = rezeptAbteilungPanel.FindControl("Lit " + Helper.REZEPBEARBEITEN_IDENT_NEUE_REZEPTABTEILUNG_BUTTON + rezeptAbteilungPanel.ID);
rezeptAbteilungPanel.Controls.Remove(neueZutatButton);
rezeptAbteilungPanel.Controls.Remove(neueRezeptAbteilungButton);
rezeptAbteilungPanel.Controls.Remove(neueZutatButtonLit);
//Neue Zutatenliste Eingaben einfügen inkl. leeren Eintrag
this.DisplayNeueZutatenListeEingaben(rezeptAbteilungPanel, zutatenAnzahl-1);
this.DisplayNeueZutatButton(rezeptAbteilungPanel);
rezeptAbteilungPanel.Controls.Add(new Literal { Text = " " });
DisplayNeueRezeptabteilungButton(rezeptAbteilungPanel);
}
else
{
for (int i = 0; i < zutatenAnzahl; i++)
{
//Neue Zutatenliste Eingaben einfügen inkl. leeren Eintrag
this.DisplayNeueZutatenListeEingaben(rezeptAbteilungPanel, i);
//Der leeren Eintrag erhält den neue Zutat Button und den neuen Rezeptabteilung Button
if (i == zutatenAnzahl - 1)
{
this.DisplayNeueZutatButton(rezeptAbteilungPanel);
rezeptAbteilungPanel.Controls.Add(new Literal { Text = " ", ID = "Lit " + Helper.REZEPBEARBEITEN_IDENT_NEUE_REZEPTABTEILUNG_BUTTON + rezeptAbteilungPanel.ID });
DisplayNeueRezeptabteilungButton(rezeptAbteilungPanel);
}
}
}
}
示例5: getCbxResult
private String getCbxResult(Panel pnlID, String cbxID)
{
CheckBox tempCbx = pnlID.FindControl(cbxID) as CheckBox;
if (tempCbx != null)
{
return tempCbx.Checked.ToString();
}
else
{
return null;
}
}
示例6: LoadState
public static void LoadState(
Panel parentControl,
mojoProfilePropertyDefinition propertyDefinition)
{
String controlID;
Control control;
switch (propertyDefinition.Type)
{
case "System.Boolean":
controlID = "chk" + propertyDefinition.Name;
control = parentControl.FindControl(controlID);
if (control != null)
{
propertyDefinition.StateValue = ((CheckBox)control).Checked.ToString();
}
break;
case "System.DateTime":
controlID = "dp" + propertyDefinition.Name;
control = parentControl.FindControl(controlID);
if (control != null)
{
DatePickerControl dp = (DatePickerControl)control;
if (dp.Text.Length > 0)
{
propertyDefinition.StateValue = dp.Text;
}
}
break;
case "System.String":
default:
if (propertyDefinition.OptionList.Count > 0)
{
if (propertyDefinition.Type == "CheckboxList")
{
controlID = "cbl" + propertyDefinition.Name;
control = parentControl.FindControl(controlID);
if (control != null)
{
if (control is CheckBoxList)
{
CheckBoxList cbl = (CheckBoxList)control;
propertyDefinition.StateValue = cbl.Items.SelectedItemsToCommaSeparatedString();
}
}
}
else
{
controlID = "dd" + propertyDefinition.Name;
control = parentControl.FindControl(controlID);
if (control != null)
{
if (control is DropDownList)
{
DropDownList dd = (DropDownList)control;
if (dd.SelectedIndex > -1)
{
propertyDefinition.StateValue = dd.SelectedValue;
}
}
}
}
}
else
{
controlID = "txt" + propertyDefinition.Name;
control = parentControl.FindControl(controlID);
if (control != null)
{
propertyDefinition.StateValue = ((TextBox)control).Text;
}
}
break;
}
}
示例7: getCbxResult
private String getCbxResult(Panel pnlID, String cbxID)
{
System.Diagnostics.Debug.WriteLine(">> In getCbxResult(" + pnlID.ID + ", " + cbxID + ")");
CheckBox tempCbx = pnlID.FindControl(cbxID) as CheckBox;
if (tempCbx != null)
{
return tempCbx.Checked.ToString();
}
else
{
return null;
}
}
示例8: getTbx
private TextBox getTbx(Panel pnlID, string tbxID)
{
// throw new NotImplementedException();
TextBox tempTbx = pnlID.FindControl(tbxID) as TextBox;
if (tempTbx != null)
{
return tempTbx;
}
else
{
return null;
}
}
示例9: processBtnUpdateCbxs
private void processBtnUpdateCbxs(Panel pnlID, string numOfCbxsTbxID, String cbxPrefix, string outTbxID)
{
System.Diagnostics.Debug.WriteLine(">> In processBtnUpdateCbxs(..)");
int numOfCbxs, i;
String myStringVariable = string.Empty;
TextBox numOfCbxsTbx = getTbx(pnlID, numOfCbxsTbxID);
TextBox outTbx = getTbx(pnlID, outTbxID);
CheckBox cbx;
if (numOfCbxsTbx != null && outTbx != null)
{
numOfCbxs = getIntFrom(pnlID, numOfCbxsTbxID);
if (numOfCbxs > 0)
{
outTbx.Text = "";
for (i = 1; i <= numOfCbxs; i++)
{
cbx = pnlID.FindControl(cbxPrefix + i.ToString()) as CheckBox;
if (cbx != null)
{
outTbx.Text += ", " + cbx.ID + "=" + cbx.Checked.ToString();
}
}
}
}
else
{
if (numOfCbxsTbx == null)
myStringVariable = numOfCbxsTbxID;
if (outTbx == null)
myStringVariable = myStringVariable + " " + outTbxID ;
myStringVariable = myStringVariable + " cannot be found";
// ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable + "');", true);
doAlert(myStringVariable);
}
}
示例10: getTbx
private TextBox getTbx(Panel pnlID, string tbxID)
{
// throw new NotImplementedException();
System.Diagnostics.Debug.WriteLine(">> In getTbx(" + pnlID.ID + ", " + tbxID + ")");
TextBox tempTbx = pnlID.FindControl(tbxID) as TextBox;
if (tempTbx != null)
{
return tempTbx;
}
else
{
return null;
}
}
示例11: getIntFrom
private int getIntFrom(Panel pnlID, string tbxID)
{
// throw new NotImplementedException();
System.Diagnostics.Debug.WriteLine(">> In getIntFrom(" + pnlID.ID + ", " + tbxID + ")");
TextBox tempTbx = pnlID.FindControl(tbxID) as TextBox;
if (tempTbx != null)
{
int result;
if (int.TryParse(tempTbx.Text, out result))
{
return result;
}
else
{
return 0;
}
}
else
{
return 0;
}
}
示例12: SeguridadInspeccion
/// <summary>
/// Determina la visualización de las opciones disponibles para el usuario
/// </summary>
/// <param name="uid">Identificacion del usuario</param>
/// <param name="controlPanel">Panel donde se ubican los controles a determinar su presentacion</param>
public static void SeguridadInspeccion(Object uid, Panel controlPanel)
{
if (uid != null)
{
int uidValue = int.Parse((string)uid);
if (uidValue == 1)
{
((ImageButton)controlPanel.FindControl("anularImageButton")).Visible = false;
((ImageButton)controlPanel.FindControl("aprobarImageButton")).Visible = false;
((ImageButton)controlPanel.FindControl("desaprobarImageButton")).Visible = false;
((ImageButton)controlPanel.FindControl("terminarImageButton")).Visible = true;
}
else if (uidValue == 2)
{
controlPanel.Visible = false;
}
}
}
示例13: CheckEmptySearch
protected bool CheckEmptySearch(Panel panel)
{
bool searchOnCommission = true;
bool searchOnPremiere = true;//string.IsNullOrEmpty(premiereControl.SelectedValue.Trim());
var commissionControl = (DropDownList)panel.FindControl("WorkCommissions");
if (commissionControl != null) searchOnCommission = string.IsNullOrEmpty(commissionControl.SelectedValue.Trim());
var premiereControl = (DropDownList)panel.FindControl("WorkPremiere");
if (premiereControl != null) searchOnPremiere = string.IsNullOrEmpty(premiereControl.SelectedValue.Trim());
return panel.Controls.OfType<TextBox>().All(input => String.IsNullOrEmpty(input.Text.Trim())) && searchOnCommission && searchOnPremiere;
}
示例14: SetDataToControlsOnPanel
public static void SetDataToControlsOnPanel(Panel oPanel, DataTable oDT, int eFormID)
{
foreach (System.Web.UI.Control oControl in oPanel.Controls)
{
for (int n = 0; n <= oDT.Columns.Count - 1; n++)
{
string ColumnName = oDT.Columns[n].ColumnName;
Control oWControl = oPanel.FindControl("txtEform" + ColumnName) as Control;
if (oWControl != null)
{
TextBox oText = oWControl as TextBox;
oText.Text = oDT.Rows[0][ColumnName].ToString();
}
Control oOtherControl = oPanel.FindControl(ColumnName) as Control;
if (oOtherControl != null)
{
if (oOtherControl is TextBox)
{
TextBox oText = oOtherControl as TextBox;
oText.Text = oDT.Rows[0][ColumnName].ToString();
}
else if (oOtherControl is DropDownList)
{
DropDownList oDDL = oOtherControl as DropDownList;
oDDL.SelectedValue = oDT.Rows[0][ColumnName].ToString();
}
else if (oOtherControl is CheckBox)
{
CheckBox oChk = oOtherControl as CheckBox;
if (oDT.Rows[0][ColumnName].ToString() != string.Empty)
{
if (Convert.ToBoolean(oDT.Rows[0][ColumnName]) == false)
{
oChk.Checked = false;
}
else
{
oChk.Checked = true;
}
}
}
else if (oOtherControl is UserControl)
{
if (oDT.Rows[0][ColumnName] != null)
{
if (oDT.Rows[0][ColumnName].ToString() != string.Empty)
{
if (HttpContext.Current.Session[ImageList] == null)
{
Hashtable oImageValue = new Hashtable();
oImageValue.Add(oOtherControl.ClientID, oDT.Rows[0][ColumnName].ToString());
HttpContext.Current.Session[ImageList] = oImageValue;
HttpContext.Current.Session[FormDesign.SessionImageList] = oImageValue;
ucImageControl oImage = oOtherControl as ucImageControl;
oImage.SetImagePath();
}
else
{
if (oDT.Rows[0][ColumnName] != null)
{
Hashtable oImageValue = HttpContext.Current.Session[ImageList] as Hashtable;
if (!oImageValue.ContainsKey(oOtherControl.ClientID))
{
oImageValue.Add(oOtherControl.ClientID, oDT.Rows[0][ColumnName].ToString());
HttpContext.Current.Session[ImageList] = oImageValue;
HttpContext.Current.Session[FormDesign.SessionImageList] = oImageValue;
ucImageControl oImage = oOtherControl as ucImageControl;
oImage.SetImagePath();
}
}
}
}
}
}
}
}
}
}
示例15: GetText
public string GetText(Panel pn)
{
string strQueryText = "";
for (int i = 0; i < this.Columns.Count; i++)
{
string text = "";
//if (pn.FindControl("txt" + i.ToString()) == null)
//{
// return "GetText Error!Can't find control in panel: " + pn.ID;
//}
switch (((WebQueryColumns)this.Columns[i]).ColumnType)
{
case "ClientQueryTextBoxColumn":
text = (pn.FindControl("txt" + i.ToString()) as TextBox).Text;
break;
case "ClientQueryComboBoxColumn":
text = (pn.FindControl("txt" + i.ToString()) as WebDropDownList).SelectedValue;
break;
case "ClientQueryRefValColumn":
text = (pn.FindControl("txt" + i.ToString()) as WebRefVal).BindingValue;
break;
case "ClientQueryCalendarColumn":
text = (pn.FindControl("txt" + i.ToString()) as WebDateTimePicker).Text;
break;
}
if (text != string.Empty)
{
strQueryText += ((WebQueryColumns)this.Columns[i]).Caption
+ ((WebQueryColumns)this.Columns[i]).Operator
+ text + "\n";
}
}
return strQueryText;
}