本文整理汇总了C#中System.Web.UI.WebControls.DataGridItem.FindControl方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridItem.FindControl方法的具体用法?C# DataGridItem.FindControl怎么用?C# DataGridItem.FindControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.DataGridItem
的用法示例。
在下文中一共展示了DataGridItem.FindControl方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Insert
private void Insert(DataGridItem e)
{
try
{
TextBox txtName = e.FindControl("txtName") as TextBox;
TextBox txtAddress = e.FindControl("txtAddress") as TextBox;
DropDownList ddlType = e.FindControl("ddlType") as DropDownList;
List<SqlParameter> pars = new List<SqlParameter>();
pars.Add(new SqlParameter("@Name", txtName.Text));
pars.Add(new SqlParameter("@Address", txtAddress.Text));
pars.Add(new SqlParameter("@Type", ddlType.SelectedValue));
DBHelper.ExecuteNonQuery("sp_Support_AddNew", pars);
Notify.ShowAdminMessageSuccess("Thêm mới thành công", this.Page);
dtgSupport.CurrentPageIndex = 0;
LoadGrid();
}
catch
{
Notify.ShowAdminMessageError("Lỗi", this.Page);
LoadGrid();
return;
}
}
示例2: Insert
private void Insert(DataGridItem e)
{
try
{
string url = (e.FindControl("txtUrl") as TextBox).Text;
string detail = (e.FindControl("txtDetail") as TextBox).Text;
List<SqlParameter> pars = new List<SqlParameter>();
pars.Add(new SqlParameter("@Url", url));
pars.Add(new SqlParameter("@Detail", detail));
DBHelper.ExecuteNonQuery("sp_Video_AddNew", pars);
Notify.ShowAdminMessageSuccess("Thêm mới thành công", this.Page);
dtgVideo.CurrentPageIndex = 0;
LoadGrid();
}
catch
{
Notify.ShowAdminMessageError("Lỗi", this.Page);
LoadGrid();
return;
}
}
示例3: Delete
private void Delete(DataGridItem e)
{
try
{
string id = (e.FindControl("lblId") as Label).Text;
List<SqlParameter> pars = new List<SqlParameter>();
pars.Add(new SqlParameter("@Id", id));
DBHelper.ExecuteNonQuery("sp_Video_Delete", pars);
Notify.ShowAdminMessageSuccess("Đã xóa", this.Page);
dtgVideo.CurrentPageIndex = 0;
LoadGrid();
Response.Redirect("VideoManager.aspx");
}
catch
{
Response.Redirect("VideoManager.aspx");
}
}
示例4: ClearColumn
protected void ClearColumn(DataGridItem item)
{
((DropDownList) item.FindControl("ddlFunction")).SelectedValue = "-1";
((TextBox) item.FindControl("txtExpression")).Text = "";
((RadioButtonList) item.FindControl("rblActive")).SelectedValue = "1";
CalendarPopup dtExpression = (CalendarPopup) item.FindControl("dtExpression");
dtExpression.SelectedDate = dtExpression.LowerBoundDate;
CalendarPopup dtTo = (CalendarPopup) item.FindControl("dtTo");
dtTo.SelectedDate = dtTo.LowerBoundDate;
CalendarPopup dtFrom = (CalendarPopup) item.FindControl("dtFrom");
dtFrom.SelectedDate = dtFrom.LowerBoundDate;
((TextBox) item.FindControl("txtFrom")).Text = "";
((TextBox) item.FindControl("txtTo")).Text = "";
((CheckBox) item.FindControl("chkColumnSort")).Checked = false;
((DropDownList) item.FindControl("ddlColumnSortDirection")).SelectedValue = "asc";
}
示例5: GetExpression
private string GetExpression(DataGridItem dgi)
{
QuickReport.DataTypes _DataType = (QuickReport.DataTypes) Convert.ToInt32(((Label) dgi.FindControl("lblDataTypeID")).Text);
string Function = ((DropDownList) dgi.FindControl("ddlFunction")).SelectedValue;
DateTime dtSingle = ((CalendarPopup) dgi.FindControl("dtExpression")).SelectedDate;
DateTime DateFrom = ((CalendarPopup) dgi.FindControl("dtFrom")).SelectedDate;
DateTime DateTo = ((CalendarPopup) dgi.FindControl("dtTo")).SelectedDate;
string ActiveValue = ((RadioButtonList) dgi.FindControl("rblActive")).SelectedValue;
string strSingle = ((TextBox) dgi.FindControl("txtExpression")).Text;
string strFrom = ((TextBox) dgi.FindControl("txtFrom")).Text;
string strTo = ((TextBox) dgi.FindControl("txtTo")).Text;
string Expression = "";
switch(_DataType)
{
case QuickReport.DataTypes.DateTime:
{
if (Function == "between")
{
if (DateFrom != DateTime.MinValue)
{
Expression = "'" + DateFrom.ToString() + "'";
}
else
{
Expression = "'" + DateTime.MinValue.ToString() + "'";
}
Expression += "|";
if (DateTo != DateTime.MinValue)
{
Expression += "'" + DateTo.ToString() + "'";
}
else
{
Expression += "'" + DateTime.MaxValue.ToString() + "'";
}
}
else
{
if (dtSingle != DateTime.MinValue)
{
Expression = "'" + dtSingle.ToString() + "'";
}
else
{
Expression = "'" + DateTime.MinValue.ToString() + "'";
}
}
break;
}
case QuickReport.DataTypes.Boolean:
{
Expression = ActiveValue;
break;
}
default:
{
if (Function == "between")
{
Expression = "'" + strFrom + "'|'" + strTo + "'";
}
else
{
Expression = "'" + strSingle + "'";
}
break;
}
}
return Expression;
}
示例6: GetSort
private void GetSort(DataGridItem dgi, string[] holder, string columnName)
{
string Sort = "";
int order = 0;
if (((CheckBox) dgi.FindControl("chkColumnSort")).Checked)
{
order = Convert.ToInt32(((HtmlInputHidden) dgi.FindControl("hdnSortOrder")).Value);
Sort = ((DropDownList) dgi.FindControl("ddlColumnSortDirection")).SelectedValue;
holder[order-1] = "[" + columnName + "] " + Sort;
}
}
示例7: SetValueColumnVisiblity
protected void SetValueColumnVisiblity(DataGridItem item)
{
HtmlGenericControl divtxtExpression = (HtmlGenericControl) item.FindControl("divtxtExpression");
HtmlGenericControl divdtExpression = (HtmlGenericControl) item.FindControl("divdtExpression");
HtmlGenericControl divrblActive = (HtmlGenericControl) item.FindControl("divrblActive");
HtmlGenericControl divtxtRange = (HtmlGenericControl) item.FindControl("divtxtRange");
HtmlGenericControl divdtRange = (HtmlGenericControl) item.FindControl("divdtRange");
DropDownList ddlFunction = (DropDownList) item.FindControl("ddlFunction");
divtxtExpression.Attributes["style"] = "display:none";
divdtExpression.Attributes["style"] = "display:none";
divrblActive.Attributes["style"] = "display:none";
divtxtRange.Attributes["style"] = "display:none";
divdtRange.Attributes["style"] = "display:none";
if (((Label) item.FindControl("lblDataTypeID")).Text != "")
{
QuickReport.DataTypes dataType = (QuickReport.DataTypes) Convert.ToInt32(((Label) item.FindControl("lblDataTypeID")).Text);
switch(dataType)
{
case QuickReport.DataTypes.DateTime:
{
divtxtExpression.Visible = false;
divtxtRange.Visible = false;
divrblActive.Visible = false;
if (ddlFunction.SelectedValue == "-1")
{
ClearColumn(item);
}
else if (ddlFunction.SelectedValue == "between")
{
divdtRange.Attributes["style"] = "display:block";
}
else
{
divdtExpression.Attributes["style"] = "display:block";
}
break;
}
case QuickReport.DataTypes.Boolean:
{
divtxtExpression.Visible = false;
divdtExpression.Visible = false;
divtxtRange.Visible = false;
divdtRange.Visible = false;
if (ddlFunction.SelectedValue == "-1")
{
ClearColumn(item);
}
else
{
divrblActive.Attributes["style"] = "display:block";
}
break;
}
case QuickReport.DataTypes.Integer:
case QuickReport.DataTypes.String:
{
divdtExpression.Visible = false;
divdtRange.Visible = false;
divrblActive.Visible = false;
if (ddlFunction.SelectedValue == "-1")
{
ClearColumn(item);
}
else if (ddlFunction.SelectedValue == "between")
{
divtxtRange.Attributes["style"] = "display:block";
}
else
{
divtxtExpression.Attributes["style"] = "display:block";
}
break;
}
}
}
}
示例8: SetValueColumnVisiblity
protected void SetValueColumnVisiblity(DataGridItem item)
{
QuickReport.DataTypes dataType = (QuickReport.DataTypes) Convert.ToInt32(((Label) item.FindControl("lblDataTypeID")).Text);
DropDownList ddlFunction = (DropDownList) item.FindControl("ddlFunction");
TextBox txtExpression = (TextBox) item.FindControl("txtExpression");
RadioButtonList rbl = (RadioButtonList) item.FindControl("lstActive");
CalendarPopup dtParameter = (CalendarPopup) item.FindControl("dtParameter");
CalendarPopup dtParameterTo = (CalendarPopup) item.FindControl("dtParameterTo");
CalendarPopup dtParameterFrom = (CalendarPopup) item.FindControl("dtParameterFrom");
Label lblFrom = (Label) item.FindControl("lblFrom");
Label lblTo = (Label) item.FindControl("lblTo");
TextBox txtFrom = (TextBox) item.FindControl("txtFrom");
TextBox txtTo = (TextBox) item.FindControl("txtTo");
rbl.Visible = false;
dtParameter.Visible = false;
dtParameterFrom.Visible = false;
dtParameterTo.Visible = false;
lblFrom.Visible = false;
lblTo.Visible = false;
txtExpression.Visible = false;
txtFrom.Visible = false;
txtTo.Visible = false;
switch(dataType)
{
case QuickReport.DataTypes.DateTime:
{
if (ddlFunction.SelectedValue == "-1")
{}
else if (ddlFunction.SelectedValue == "between")
{
lblFrom.Visible = true;
lblTo.Visible = true;
dtParameterTo.Visible = true;
dtParameterFrom.Visible = true;
}
else
{
dtParameter.Visible = true;
}
break;
}
case QuickReport.DataTypes.Boolean:
{
if (ddlFunction.SelectedValue == "-1")
{}
else
{
rbl.Visible = true;
}
break;
}
case QuickReport.DataTypes.Integer:
case QuickReport.DataTypes.String:
{
if (ddlFunction.SelectedValue == "-1")
{}
else if (ddlFunction.SelectedValue == "between")
{
lblFrom.Visible = true;
lblTo.Visible = true;
txtFrom.Visible = true;
txtTo.Visible = true;
}
else
{
txtExpression.Visible = true;
}
break;
}
}
}
示例9: FillDataGridItem
public void FillDataGridItem(DataGridItem dgi)
{
((Label) dgi.FindControl("lblDataTypeID")).Text = Convert.ToInt32(_DataType).ToString();
((Label) dgi.FindControl("lblTokenTypeID")).Text = Convert.ToInt32(_TokenType).ToString();
((DropDownList) dgi.FindControl("ddlFunction")).SelectedValue = Function;
((RadioButtonList) dgi.FindControl("lstActive")).SelectedValue = ActiveValue;
((CalendarPopup) dgi.FindControl("dtParameter")).SelectedDate = SingleDate;
((CalendarPopup) dgi.FindControl("dtParameterFrom")).SelectedDate = DateFrom;
((CalendarPopup) dgi.FindControl("dtParameterTo")).SelectedDate = DateTo;
((TextBox) dgi.FindControl("txtExpression")).Text = SingleText;
((TextBox) dgi.FindControl("txtFrom")).Text = strFrom;
((TextBox) dgi.FindControl("txtTo")).Text = strTo;
((CheckBox) dgi.FindControl("chkColumnSort")).Checked = SortBy;
((DropDownList) dgi.FindControl("ddlColumnSortDirection")).SelectedValue = SortDirection;
}
示例10: Token
public Token(DataGridItem dgi)
{
_TokenID = Convert.ToInt32(((Label) dgi.FindControl("lblTokenID")).Text);
_TokenAlias = ((Label) dgi.FindControl("lblTokenName")).Text;
_Hidden = ! ((CheckBox) dgi.FindControl("chkHidden")).Checked;
_DataType = (QuickReport.DataTypes) Convert.ToInt32(((Label) dgi.FindControl("lblDataTypeID")).Text);
_TokenType = (QuickReport.TokenTypes) Convert.ToInt32(((Label) dgi.FindControl("lblTokenTypeID")).Text);
_Function = ((DropDownList) dgi.FindControl("ddlFunction")).SelectedValue;
SortBy = ((CheckBox) dgi.FindControl("chkColumnSort")).Checked;
SortDirection = ((DropDownList) dgi.FindControl("ddlColumnSortDirection")).SelectedValue;
SingleDate = ((CalendarPopup) dgi.FindControl("dtParameter")).SelectedDate;
DateFrom = ((CalendarPopup) dgi.FindControl("dtParameterFrom")).SelectedDate;
DateTo = ((CalendarPopup) dgi.FindControl("dtParameterTo")).SelectedDate;
SingleText = ((TextBox) dgi.FindControl("txtExpression")).Text;
strFrom = ((TextBox) dgi.FindControl("txtFrom")).Text;
strTo = ((TextBox) dgi.FindControl("txtTo")).Text;
ActiveValue = ((RadioButtonList) dgi.FindControl("lstActive")).SelectedValue;
_TokenOrder = Convert.ToInt32(((Label) dgi.FindControl("lblTokenOrder")).Text);
}
示例11: Insert
private void Insert(DataGridItem e)
{
try
{
string name = (e.FindControl("txtCatName") as TextBox).Text;
bool isSub = (e.FindControl("chkSubCat") as CheckBox).Checked;
int parentId = 0;
if (isSub)
parentId = Convert.ToInt32((e.FindControl("ddlCat") as DropDownList).SelectedValue);
List<SqlParameter> pars = new List<SqlParameter>();
pars.Add(new SqlParameter("@Name", name));
pars.Add(new SqlParameter("@IsSubCat", isSub));
pars.Add(new SqlParameter("@ParentId", parentId));
DBHelper.ExecuteNonQuery("sp_Category_InsertNew", pars);
Notify.ShowAdminMessageSuccess("Thêm mới thành công", this.Page);
dtgCategory.CurrentPageIndex = 0;
LoadGrid();
}
catch
{
Notify.ShowAdminMessageError("Lỗi", this.Page);
LoadGrid();
return;
}
}
示例12: Update
private void Update(DataGridItem e)
{
try
{
string id = (e.FindControl("lblId") as Label).Text;
string url = (e.FindControl("txtUrl") as TextBox).Text;
string detail = (e.FindControl("txtDetail") as TextBox).Text;
bool isChecked = (e.FindControl("chkActive") as CheckBox).Checked;
List<SqlParameter> pars = new List<SqlParameter>();
pars.Add(new SqlParameter("@Id", id));
pars.Add(new SqlParameter("@Url", url));
pars.Add(new SqlParameter("@Detail", detail));
pars.Add(new SqlParameter("@Active", isChecked));
DBHelper.ExecuteNonQuery("sp_Video_Update", pars);
Notify.ShowAdminMessageSuccess("Update thành công", this.Page);
dtgVideo.CurrentPageIndex = 0;
LoadGrid();
}
catch
{
Notify.ShowAdminMessageError("Lỗi !!!", this.Page);
LoadGrid();
return;
}
}
示例13: GetSort
private string GetSort(DataGridItem dgi)
{
string Sort = "";
if (((CheckBox) dgi.FindControl("chkColumnSort")).Checked)
{
Sort = ((DropDownList) dgi.FindControl("ddlColumnSortDirection")).SelectedValue;
}
return Sort;
}
示例14: DeleteItem
/// <summary>
/// Deletes the item.
/// </summary>
/// <param name="e">The e.</param>
private void DeleteItem(DataGridItem e)
{
LinkButton lnkName = (LinkButton) e.FindControl("lnkName");
int type = int.Parse(dgFile.DataKeys[e.ItemIndex].ToString());
if (type == 0)
{
Directory.Delete(System.IO.Path.Combine(GetCurDir(), lnkName.Text), true);
}
else
{
File.Delete(System.IO.Path.Combine(GetCurDir(), lnkName.Text));
}
}