本文整理汇总了C#中System.Web.UI.WebControls.GridViewRow.FindControl方法的典型用法代码示例。如果您正苦于以下问题:C# GridViewRow.FindControl方法的具体用法?C# GridViewRow.FindControl怎么用?C# GridViewRow.FindControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.GridViewRow
的用法示例。
在下文中一共展示了GridViewRow.FindControl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckGridControlPermissions
protected void CheckGridControlPermissions(GridViewRow row)
{
var modifyButton = row.FindControl("imgBtnEdit");
if (modifyButton != null)
{
modifyButton.Visible = PermissionManager.UserHasPermission(this.module, Permissions.Modify);
}
var deleteButton = row.FindControl("imgBtnDelete");
if (deleteButton != null)
{
deleteButton.Visible = PermissionManager.UserHasPermission(this.module, Permissions.Remove);
}
}
示例2: GetLeadItemId
/// <summary>Gets the ID of the lead entry in the given row.</summary>
/// <param name="row">The row from which to get the lead ID.</param>
/// <returns>THe ID of the lead in the given row, or <c>null</c> if there isn't a lead in that row</returns>
private static int? GetLeadItemId(GridViewRow row)
{
var hdnLeadId = row.FindControl("hdnLeadId") as HiddenField;
int leadId;
if (hdnLeadId != null && int.TryParse(hdnLeadId.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out leadId))
{
return leadId;
}
return null;
}
示例3: SetPagerButtonStates
/// <summary>
/// Sets the pager button states.
/// </summary>
/// <param name="gridView">The grid view.</param>
/// <param name="gvPagerRow">The gv pager row.</param>
/// <param name="page">The page.</param>
public static void SetPagerButtonStates(GridView gridView, GridViewRow gvPagerRow, Page page)
{
int pageIndex = gridView.PageIndex;
int pageCount = gridView.PageCount;
ImageButton btnFirst = (ImageButton)gvPagerRow.FindControl("btnFirst");
ImageButton btnPrevious = (ImageButton)gvPagerRow.FindControl("btnPrevious");
ImageButton btnNext = (ImageButton)gvPagerRow.FindControl("btnNext");
ImageButton btnLast = (ImageButton)gvPagerRow.FindControl("btnLast");
btnFirst.Enabled = btnPrevious.Enabled = (pageIndex != 0);
btnNext.Enabled = btnLast.Enabled = (pageIndex < (pageCount - 1));
DropDownList ddlPageSelector = (DropDownList)gvPagerRow.FindControl("ddlPages");
ddlPageSelector.Items.Clear();
for (int i = 1; i <= gridView.PageCount; i++)
{
ddlPageSelector.Items.Add(i.ToString());
}
ddlPageSelector.SelectedIndex = pageIndex;
Label lblPageCount = (Label)gvPagerRow.FindControl("lblPageCount");
lblPageCount.Text = pageCount.ToString();
//ddlPageSelector.SelectedIndexChanged += delegate
//{
// gridView.PageIndex = ddlPageSelector.SelectedIndex;
// gridView.DataBind();
//};
}
示例4: BuildLookupValueReturnControl
//Financial_Application.SearchUtility.BankSearch objSl = new SearchUtility.BankSearch();
public void BuildLookupValueReturnControl(GridViewRow e, string LinkControlId)
{
string js;
string txt;
HyperLink h1;
// Label lblMessage;
//string type;
if (e.RowType == DataControlRowType.DataRow)
{
h1 = (HyperLink)e.FindControl(LinkControlId);
txt = (string)h1.Text;
// lblMessage = (Label)e.FindControl(Status);
// txt1 = (string)lblMessage.Text;
if (HttpContext.Current.Request.QueryString["setLookupValueToControlID1"] == "")
{
if (HttpContext.Current.Request.QueryString["PostBackParentForm"] != String.Empty)
{
js = BuildJS_ReturnLookupValue(HttpContext.Current.Request.QueryString["setLookupValueToControlID"], txt, HttpContext.Current.Request.QueryString["PostBackParentForm"], "", "");
}
else
{
js = BuildJS_ReturnLookupValue(HttpContext.Current.Request.QueryString["setLookupValueToControlID"], txt, "true", "", "");
}
}
else
{
if (HttpContext.Current.Request.QueryString["PostBackParentForm"] != String.Empty)
{
js = BuildJS_ReturnLookupValue(HttpContext.Current.Request.QueryString["setLookupValueToControlID"], txt, HttpContext.Current.Request.QueryString["PostBackParentForm"], HttpContext.Current.Request.QueryString["setLookupValueToControlID1"], e.Cells[2].Text);
}
else
{
js = BuildJS_ReturnLookupValue(HttpContext.Current.Request.QueryString["setLookupValueToControlID"], txt, "true", HttpContext.Current.Request.QueryString["setLookupValueToControlID1"], e.Cells[2].Text);
}
h1.NavigateUrl = "javascript://";
//h1.NavigateUrl =
h1.Attributes.Add("onclick", js);
}
}
}
示例5: CustomizeFilesystemColumn
protected void CustomizeFilesystemColumn(GridViewRow row)
{
Label text = row.FindControl("Filesystem") as Label;
ServiceLock item = row.DataItem as ServiceLock;
if (text != null && item != null)
text.Text = item.FilesystemKey == null ? "N/A" : _fsController.LoadFileSystem(item.FilesystemKey).Description;
}
示例6: CustomizeLockColumn
protected void CustomizeLockColumn(GridViewRow row)
{
Image img = row.FindControl("LockedImage") as Image;
ServiceLock item = row.DataItem as ServiceLock;
if (img != null && item != null)
{
img.ImageUrl = item.Lock ? ImageServerConstants.ImageURLs.Checked : ImageServerConstants.ImageURLs.Unchecked;
}
}
示例7: SetLinkButton
protected void SetLinkButton(GridViewRow gvr, string id, bool enabled)
{
LinkButton linkButton = (LinkButton)gvr.FindControl(id);
linkButton.Enabled = enabled && !isExport;
}
示例8: AddDraftBillJavascriptFunctions
/// <summary>
/// Adds the draft bill javascript functions to calculate the billed and unbilled amounts
/// when the billed amount changes or the bill link is clicked.
/// </summary>
/// <param name="gridRow">The grid row.</param>
private void AddDraftBillJavascriptFunctions(GridViewRow gridRow)
{
try
{
Control txtBilled = gridRow.FindControl("_txtBilled");
Control lblUnbilled = gridRow.FindControl("_lblUnBilled");
Control lblAmount = gridRow.FindControl("_lblAmount");
Control lnkBtnBill = gridRow.FindControl("_lnkBtnBill");
if (lblAmount != null && txtBilled != null && lblUnbilled != null && lnkBtnBill != null)
{
TextBox billedAmount = (TextBox)txtBilled;
billedAmount.Attributes.Add("onchange", string.Format("CalcUnbilled('{0}','{1}','{2}');",
lblAmount.ClientID,
txtBilled.ClientID,
lblUnbilled.ClientID));
LinkButton lnkBill = (LinkButton)lnkBtnBill;
lnkBill.Attributes.Add("onclick", string.Format("return Billed('{0}','{1}','{2}');",
lblAmount.ClientID,
txtBilled.ClientID,
lblUnbilled.ClientID));
}
}
catch (Exception ex)
{
throw ex;
}
}
示例9: RowChanged
public static bool RowChanged(GridViewRow gvr)
{
for (var i = 1; i < gvr.Cells.Count - 2; i++)
{
var cb = gvr.FindControl("CheckBox" + (i + 8)) as CheckBox;
if (cb == null)
{
continue;
}
if (gvr.Cells[i].BackColor == Color.Blue && !cb.Checked)
{
return true;
}
if (cb.Checked)
{
return true;
}
}
return false;
}
示例10: FillForm
private void FillForm(GridViewRow gridViewRow)
{
ValueHiddenField.Value = ((Label)gridViewRow.FindControl("lblUserId")).Text;
txtTransporter.Text = ((Label)gridViewRow.FindControl("lblTransporterName")).Text;
txtFirstName.Text = ((Label)gridViewRow.FindControl("lblFirstName")).Text;
txtLName.Text = ((Label)gridViewRow.FindControl("lblLastName")).Text;
txtmobile.Text = ((Label)gridViewRow.FindControl("lblMobileNo")).Text;
txtEmail.Text = ((Label)gridViewRow.FindControl("lblEmail")).Text;
txtAddress.Text = ((Label)gridViewRow.FindControl("lblAddress")).Text;
txtCity.Text = ((Label)gridViewRow.FindControl("lblCityName")).Text;
txtCityId.Text = ((Label)gridViewRow.FindControl("lblCityId")).Text;
ddlPincode.Enabled = true;
Fillddl(Convert.ToInt16(txtCityId.Text));
//ddlPincode.Items.FindByValue(((Label)gridViewRow.FindControl("lblPinCode")).Text).Selected = true;
var PinId = ((Label)gridViewRow.FindControl("lblPincode")).Text;
ddlPincode.Items.FindByText(PinId).Selected = true;
}
示例11: CustomizePartitionStorageConfiguration
private void CustomizePartitionStorageConfiguration(GridViewRow row)
{
ServerPartition partition = row.DataItem as ServerPartition;
Label lbl = row.FindControl("PartitionStorageConfigurationLabel") as Label; // The label is added in the template
if (lbl != null)
{
if (partition.HasEnabledDeleteRules)
lbl.Text = Resources.SR.PartitionStorageConfiguration_DeleteRuleExists;
else
{
lbl.Text = partition.ArchiveExists
? Resources.SR.PartitionStorageConfiguration_ArchiveConfiguredNoDeleteRule
: Resources.SR.PartitionStorageConfiguration_NoArchiveConfiguredNoDeleteRule;
}
}
}
示例12: CustomizeBooleanColumn
private void CustomizeBooleanColumn(GridViewRow row, string controlName, string fieldName)
{
var img = ((Image)row.FindControl(controlName));
if (img != null)
{
bool active = Convert.ToBoolean(DataBinder.Eval(row.DataItem, fieldName));
img.ImageUrl = active ? ImageServerConstants.ImageURLs.Checked : ImageServerConstants.ImageURLs.Unchecked;
}
}
示例13: CustomizeFilesystemTierColumn
private void CustomizeFilesystemTierColumn(GridViewRow row)
{
var fs = row.DataItem as Filesystem;
var lbl = row.FindControl("FilesystemTierDescription") as Label; // The label is added in the template
if (fs != null && lbl != null)
lbl.Text = ServerEnumDescription.GetLocalizedDescription(fs.FilesystemTierEnum);
}
示例14: CustomizePathColumn
private void CustomizePathColumn(GridViewRow row)
{
var fs = row.DataItem as Filesystem;
var lbl = row.FindControl("PathLabel") as Label; // The label is added in the template
if (fs != null && lbl!=null && fs.FilesystemPath != null)
{
// truncate it
if (fs.FilesystemPath.Length > 50)
{
lbl.Text = fs.FilesystemPath.Substring(0, 45) + "...";
lbl.ToolTip = string.Format("{0}: {1}", fs.Description, fs.FilesystemPath);
}
else
{
lbl.Text = fs.FilesystemPath;
}
}
}
示例15: CustomizeUsageColumn
private void CustomizeUsageColumn(GridViewRow row)
{
var fs = row.DataItem as Filesystem;
var img = row.FindControl("UsageImage") as Image;
float usage = GetFilesystemUsedPercentage(fs);
if (fs != null && img != null)
{
img.ImageUrl = string.Format(ImageServerConstants.PageURLs.BarChartPage,
usage,
fs.HighWatermark,
fs.LowWatermark);
img.AlternateText = string.Format(Server.HtmlEncode(Tooltips.AdminFilesystem_DiskUsage).Replace(Environment.NewLine, "<br/>"),
float.IsNaN(usage) ? SR.Unknown : usage.ToString(),
fs.HighWatermark, fs.LowWatermark);
}
}