本文整理汇总了C#中System.Web.UI.WebControls.GridViewCommandEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# GridViewCommandEventArgs类的具体用法?C# GridViewCommandEventArgs怎么用?C# GridViewCommandEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GridViewCommandEventArgs类属于System.Web.UI.WebControls命名空间,在下文中一共展示了GridViewCommandEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GridView1_RowCommand
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (Page.IsValid)
{
if (e.CommandName == "Select")
{
Users newUser;
dbHelper helper = new dbHelper();
newUser = helper.GetUserbyName(TextBoxUser.Text);
if (newUser == null)
{
newUser = new Users();
newUser.UserName = TextBoxUser.Text;
newUser.UserType = "local";
newUser.SNUserId = "local" + TextBoxUser.Text;
helper.AddToModel(newUser);
}
Session["user"] = newUser;
WebControl wc = e.CommandSource as WebControl;
GridViewRow row = wc.NamingContainer as GridViewRow;
Session["UseCaseStartTime"] = DateTime.Now;
Session["UseCaseNumber"] = row.RowIndex + 1;
Session["UseCaseText"] = row.Cells[1].Text;
Server.Transfer("Design.aspx");
}
}
}
示例2: GridView1_RowCommand
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.ToString().Equals("viewImage"))
{
Response.Redirect("ImageHome.aspx?imageId=" + Convert.ToString(e.CommandArgument), true);
}
}
示例3: GridView1_RowCommand
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
}
else if (e.CommandName == "Edit")
{
DetailsView1.ChangeMode(DetailsViewMode.Edit);
}
else if(e.CommandName == "Select")
{
DetailsView1.ChangeMode(DetailsViewMode.Edit);
}
else if(e.CommandName== "New")
{
DetailsView1.ChangeMode(DetailsViewMode.Insert);
}
else
{
string cmdname = e.CommandName.ToString();
}
}
示例4: gvContactType_RowCommand
protected void gvContactType_RowCommand(object sender, GridViewCommandEventArgs e)
{
LeadContactType contactType = null;
int contactTypeID = Convert.ToInt32(e.CommandArgument);
if (e.CommandName == "DoEdit") {
contactType = LeadContactTypeManager.Get(contactTypeID);
if (contactType != null) {
txtContactType.Text = contactType.Description;
showContactTypePanel();
}
}
else if (e.CommandName == "DoDelete") {
contactType = LeadContactTypeManager.Get(contactTypeID);
if (contactType != null) {
contactType.isActive = false;
LeadContactTypeManager.Save(contactType);
DoBind();
}
}
}
示例5: gvTrash_RowCommand
protected void gvTrash_RowCommand(object sender, GridViewCommandEventArgs e)
{
int itemIndex = Convert.ToInt32(e.CommandArgument);
int itemID = Convert.ToInt32(gvTrash.DataKeys[itemIndex].Value);
ContentItem item = Engine.Persister.Get(itemID);
if (e.CommandName == "Restore")
{
try
{
Trash.Restore(item);
this.gvTrash.DataBind();
}
catch (N2.Integrity.NameOccupiedException)
{
cvRestore.IsValid = false;
}
RegisterRefreshNavigationScript(item);
}
else if (e.CommandName == "Purge")
{
if (Trash.TrashContainer != null && Trash.TrashContainer.AsyncTrashPurging)
{
Engine.Resolve<AsyncTrashPurger>().BeginPurge(item.ID);
Response.Redirect(Request.RawUrl.ToUrl().SetQueryParameter("showStatus", "true"));
}
else
Engine.Persister.Delete(item);
}
else
{
RegisterRefreshNavigationScript(CurrentItem);
}
}
示例6: grdMain_RowCommand
protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
{
try
{
if (e.CommandName != "Page") //Paginação
{
int iIndice = grdMain.PageIndex * grdMain.PageSize + int.Parse(e.CommandArgument.ToString());
if (e.CommandName == "Alterar")
{
DataTable lTable = (DataTable)ViewState["WRK_TABLE"];
if (lTable.Rows.Count > 0)
{
txtDESCCENTES_APRESENTACAO.Text = lTable.Rows[iIndice][DESCCENTROESTUDOQD._DESCCENTES_APRESENTACAO.Name].ToString();
txtDESCCENTES_OBJETIVO.Text = lTable.Rows[iIndice][DESCCENTROESTUDOQD._DESCCENTES_OBJETIVO.Name].ToString();
txtDESCCENTES_CONTATO.Text = lTable.Rows[iIndice][DESCCENTROESTUDOQD._DESCCENTES_CONTATO.Name].ToString();
hidDESCCENTES_ID.Value = lTable.Rows[iIndice][DESCCENTROESTUDOQD._DESCCENTES_ID.Name].ToString();
}
}
else if (e.CommandName == "Excluir")
{
DataTable lTable = (DataTable)ViewState["WRK_TABLE"];
InterfaceUpdate(decimal.Parse(lTable.Rows[iIndice][DESCCENTROESTUDOQD._DESCCENTES_ID.Name].ToString()), "I");
}
}
}
catch (Exception err)
{
(new UnknownException(err)).TratarExcecao(true);
}
}
示例7: GridView1_RowCommand
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
String s = GridView1.Rows[Convert.ToInt16(e.CommandArgument)].Cells[1].Text;
Session["passing"] = s;
// the show entire items for respective row
Response.Redirect("HistoryDisbursementListDetails.aspx");
}
示例8: AddOneToPriority
private void AddOneToPriority(GridViewCommandEventArgs e)
{
Func<int, bool> func =
(int _issueId)
=> issueController.AddOneToPriority(_issueId);
ModifyIssue(e, func);
}
示例9: grdStates_OnRowCommand
protected void grdStates_OnRowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "EditRow")
{
var row = ((Control)e.CommandSource).NamingContainer as GridViewRow;
if (row != null)
{
txtStateName.Text = ((Label)(row.FindControl("lblStateName"))).Text;
ddlcountryName.SelectedValue = ((Label)(row.FindControl("lblCountryId"))).Text;
_stateId = Convert.ToInt32(((Label)(row.FindControl("lblStateId"))).Text);
}
}
else if (e.CommandName == "Del")
{
var row = ((Control)e.CommandSource).NamingContainer as GridViewRow;
if (row != null)
{
var oState = new States();
var stateId = Convert.ToInt32(((Label)(row.FindControl("lblStateId"))).Text);
MasterDataMethods.DeleteState(stateId);
FillGrid();
}
}
}
示例10: gvCourses_RowCommand
protected void gvCourses_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Delete")
{
string id = Convert.ToString(e.CommandArgument);
if (id == this.Id)
{
viewForm.Visible = false;
}
try
{
ISelection select = SelectionMgr.Get(id, LoginUser.Id);
if (select == null)
{
lblMessage.Text = "选课已取消!";
return;
}
BLL.SelectionMgr.Delete(select.Id);
lblMessage.Text = "选课取消成功!";
}
catch (Exception ex)
{
lblMessage.Text = ex.Message;
}
}
}
示例11: gvClaims_RowCommand
protected void gvClaims_RowCommand(object sender, GridViewCommandEventArgs e)
{
string[] ids = e.CommandArgument.ToString().Split(new char[] {'|'});
int claimID = Convert.ToInt32(ids[0]);
int policyID = Convert.ToInt32(ids[1]);
Claim claim = null;
if (e.CommandName == "DoEdit") {
Session["ClaimID"] = claimID;
Session["policyID"] = policyID;
Response.Redirect("~/Protected/ClaimEdit.aspx");
}
else if (e.CommandName == "DoDelete") {
try {
claim = ClaimsManager.Get(claimID);
if (claim != null) {
// make claim as deleted
claim.IsActive = false;
ClaimsManager.Save(claim);
// refresh claim list
bindData(claim.PolicyID);
}
}
catch (Exception ex) {
Core.EmailHelper.emailError(ex);
}
}
}
示例12: TransactionsTable_OnRowCommand
protected void TransactionsTable_OnRowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName != "DeleteTransaction")
return;
try
{
var connString = ConfigurationManager.ConnectionStrings["CineQuilla"].ConnectionString;
using (SqlConnection connection = new SqlConnection(connString))
{
connection.Open();
using (SqlCommand command = new SqlCommand(null, connection))
{
command.CommandText = "DELETE FROM transactions WHERE id = @id";
SqlParameter idParam = new SqlParameter("@id", SqlDbType.Int);
idParam.Value = e.CommandArgument;
command.Parameters.Add(idParam);
command.Prepare();
command.ExecuteNonQuery();
}
}
}
catch (SqlException ex)
{
ErrorLabel.Visible = true;
return;
}
Response.Redirect(Request.RawUrl);
}
示例13: UserActive
public void UserActive(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "UserActive")
{
using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
{
int index = Convert.ToInt32(e.CommandArgument);
string userstmp = GridView1.DataKeys[index].Value.ToString();
LblID.Text = userstmp;
var UserData = from u in erpdb.aspnet_Users
join m in erpdb.aspnet_Memberships on u.UserId equals m.UserId
where u.UserId.ToString() == userstmp
select new
{
user_code = u.UserName,
email = m.Email,
last_login_date = m.LastLoginDate,
register_date = m.CreateDate,
active_flag = u.MobileAlias
};
foreach (var ud in UserData)
{
txtLoginName.Text = ud.user_code;
txtEmail.Text = ud.email;
}
}
MultiView1.ActiveViewIndex = 1;
}
}
示例14: gvAmortizations_RowCommand
protected void gvAmortizations_RowCommand(object sender, GridViewCommandEventArgs e)
{
//GridViewRow gvr = (GridViewRow)((e.CommandArgument));
//int RowIndex;
//int.TryParse(e.CommandArgument.ToString(),out RowIndex);
//((CheckBox)gvAmortizations.Rows[RowIndex].FindControl("ckPaid")).Enabled = true;
}
示例15: gvProductVariantAttributeValues_RowCommand
protected void gvProductVariantAttributeValues_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "UpdateProductVariantAttributeValue")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = gvProductVariantAttributeValues.Rows[index];
HiddenField hfProductVariantAttributeValueId = row.FindControl("hfProductVariantAttributeValueId") as HiddenField;
SimpleTextBox txtName = row.FindControl("txtName") as SimpleTextBox;
DecimalTextBox txtPriceAdjustment = row.FindControl("txtPriceAdjustment") as DecimalTextBox;
DecimalTextBox txtWeightAdjustment = row.FindControl("txtWeightAdjustment") as DecimalTextBox;
CheckBox cbIsPreSelected = row.FindControl("cbIsPreSelected") as CheckBox;
NumericTextBox txtDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox;
int productVariantAttributeValueId = int.Parse(hfProductVariantAttributeValueId.Value);
string name = txtName.Text;
decimal priceAdjustment = txtPriceAdjustment.Value;
decimal weightAdjustment = txtWeightAdjustment.Value;
bool isPreSelected = cbIsPreSelected.Checked;
int displayOrder = txtDisplayOrder.Value;
ProductVariantAttributeValue productVariantAttributeValue = ProductAttributeManager.GetProductVariantAttributeValueById(productVariantAttributeValueId);
if (productVariantAttributeValue != null)
{
productVariantAttributeValue = ProductAttributeManager.UpdateProductVariantAttributeValue(productVariantAttributeValue.ProductVariantAttributeValueId,
productVariantAttributeValue.ProductVariantAttributeId, name,
priceAdjustment, weightAdjustment, isPreSelected, displayOrder);
SaveLocalizableContentGrid(productVariantAttributeValue);
}
BindData();
}
}