本文整理汇总了C#中System.Web.UI.WebControls.GridViewUpdateEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# GridViewUpdateEventArgs类的具体用法?C# GridViewUpdateEventArgs怎么用?C# GridViewUpdateEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GridViewUpdateEventArgs类属于System.Web.UI.WebControls命名空间,在下文中一共展示了GridViewUpdateEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrideRunorderGV_RowUpdating
protected void PrideRunorderGV_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
//String orderId = ((TextBox)PrideRunOrderGV.Rows[e.RowIndex].Cells[1].Controls[0]).Text; //order_id
//String status = ((DropDownList)PrideRunOrderGV.Rows[e.RowIndex].Cells[2].Controls[1]).SelectedItem.Value; // order_status
//String paymentDate = ((TextBox)PrideRunOrderGV.Rows[e.RowIndex].Cells[3].Controls[0]).Text; //payment_date
//String paymentType = ((TextBox)PrideRunOrderGV.Rows[e.RowIndex].Cells[4].Controls[0]).Text; //payment type
String orderId = ((TextBox)PrideRunOrderGV.Rows[e.RowIndex].Cells[1].Controls[0]).Text; //order_id
String status = ((DropDownList)PrideRunOrderGV.Rows[e.RowIndex].Cells[2].Controls[1]).SelectedItem.Value; // order_status
String paymentDate = ((TextBox)PrideRunOrderGV.Rows[e.RowIndex].Cells[3].Controls[0]).Text; //payment_date
String paymentType = ((TextBox)PrideRunOrderGV.Rows[e.RowIndex].Cells[4].Controls[0]).Text; //payment type
//this line above does not work....i can't get hte value
//String temp = PrideRunOrderGV.Rows[e.RowIndex].Cells[2].FindControl("statusListJovino").ToString();
//Session["statusSelected"] = (((DropDownList)sender).SelectedValue);
//status = (String)Session["statusSelected"];
//controller.updateOrderStatus(Int16.Parse(orderId), status);
controller.updateOrder(Int16.Parse(orderId), status, paymentDate, paymentType);
PrideRunOrderGV.EditIndex = -1;
this.rebind();
}
示例2: gvDSDiary_RowUpdating
protected void gvDSDiary_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = gvDSDiary.Rows[e.RowIndex];
//drdto = new DiaryDTO();
int madiary = Int32.Parse(gvDSDiary.DataKeys[e.RowIndex].Value.ToString());
//drdto.MaDiary = madiary;
//TextBox thamchieu = row.Cells[1].Controls[0] as TextBox;
//drdto.MaClaim = thamchieu.Text;
//TextBox ngay = row.Cells[2].Controls[0] as TextBox;
//drdto.Ngay = DateTime.Parse(ngay.Text);
//TextBox diengiai = row.Cells[3].Controls[0] as TextBox;
//drdto.DienGiai = diengiai.Text;
//TextBox sogio = row.Cells[4].Controls[0] as TextBox;
//drdto.SoGio = float.Parse(sogio.Text);
//TextBox batdau = row.Cells[5].Controls[0] as TextBox;
//drdto.NgayGioBatDau = DateTime.Parse(batdau.Text);
//TextBox ketthuc = row.Cells[6].Controls[0] as TextBox;
//drdto.NgayGioKetThuc = DateTime.Parse(ketthuc.Text);
TextBox ketqua = row.Cells[7].Controls[0] as TextBox;
string result=ketqua.Text;
if (result == null)
result = "Will be update late!";
bool cn = drdao.updateResult(madiary,result);
if (cn == true)
{
e.Cancel = true;
gvDSDiary.EditIndex = -1;
loadDiaryAll();
}
}
示例3: GV_RowUpdating
protected void GV_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
using (OracleConnection conn = new OracleConnection(DBHelper.ConnectionString))
{
string reason_id = GV.DataKeys[e.RowIndex].Values[0].ToString();
string reason_desc = ((TextBox)GV.Rows[e.RowIndex].FindControl("TxtDesc")).Text;
string active = ((CheckBox)(GV.Rows[e.RowIndex].FindControl("ChkActive"))).Checked == true ? "1" : "0";
string sqlupdate = "update jp_lack_reason set reason_desc = '" + reason_desc + "',is_valid='" + active + "' where reason_id = '" + reason_id + "' ";
OracleCommand updatecomm = new OracleCommand(sqlupdate, conn);
try
{
conn.Open();
updatecomm.ExecuteNonQuery();
GV.EditIndex = -1;
GVDataBind();
}
catch (Exception ex)
{
conn.Close();
Response.Write("<script language=javascript>alert('" + ex.Message + "')</script>");
}
finally
{
updatecomm.Dispose();
conn.Dispose();
conn.Close();
}
}
}
示例4: GridView1_RowUpdating
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
SqlConnection con = new SqlConnection(str);
con.Open();
GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
Label l1 = (Label)row.FindControl("lblid");
int id = Convert.ToInt32(l1.Text);
TextBox txtbox = (TextBox)row.FindControl("txtname");
String name = txtbox.Text;
GridView1.EditIndex = -1;
SqlCommand cmd = new SqlCommand("update advisor set [email protected] where [email protected]", con);
cmd.Parameters.AddWithValue("@id", id);
cmd.Parameters.AddWithValue("@name", name);
cmd.ExecuteNonQuery();
con.Close();
bind();
}
示例5: GridView1_RowUpdating
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int gvr = e.RowIndex;
string name = ((TextBox)GridView1.Rows[gvr].FindControl("txtName")).Text;
GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];
HiddenField lblid = (HiddenField)row.FindControl("lblId");
int id = Convert.ToInt32(lblid.Value);
District fd = new District();
fd.Id = id;
fd.DistrictName = name;
try
{
dMethods.Update(fd);
GridView1.EditIndex = -1;
BindGrid();
js.ShowAlert(this, "Record updated succesfully!");
}
catch (Exception ex)
{
if (ex.InnerException.InnerException.Message.Contains("UNIQUE"))
{
js.ShowAlert(this, "District already exists! Please try another name.");
}
else
{
js.ShowAlert(this, ex.Message);
}
}
}
示例6: gridTrees_RowUpdating
protected void gridTrees_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
DropDownList ddlTreeType = gridTrees.Rows[e.RowIndex].FindControl("ddlTreeTypes") as DropDownList;
if (ddlTreeType == null)
return;
int treeType;
if (!int.TryParse(ddlTreeType.SelectedValue, out treeType))
return;
string idStr = gridTrees.Rows[e.RowIndex].Cells[1].Text;
int id;
if (!int.TryParse(idStr, out id))
return;
TextBox txtDescription = gridTrees.Rows[e.RowIndex].FindControl("txtDescription") as TextBox;
if (txtDescription == null)
return;
string description = txtDescription.Text;
Tree tree = new Tree()
{
ID = id,
TreeType = treeType,
Description = description,
};
bl.UpdateTree("School101", "School101", tree);
gridTrees.EditIndex = -1;
ReloadTreesGrid();
}
示例7: gvProveedores_RowUpdating
protected void gvProveedores_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
var i = e.RowIndex;
var cod = this.gvProveedores.Rows[i].Cells[0].Text;
var raz = ( (TextBox)(this.gvProveedores.Rows[i].Cells[1].Controls[0])).Text;
var dir = ( (TextBox)(this.gvProveedores.Rows[i].Cells[2].Controls[0])).Text;
var tel = ( (TextBox)(this.gvProveedores.Rows[i].Cells[3].Controls[0])).Text;
var dis = ( (TextBox)(this.gvProveedores.Rows[i].Cells[4].Controls[0])).Text;
var rep = ( (TextBox)(this.gvProveedores.Rows[i].Cells[5].Controls[0])).Text;
objProBE .Codigo = cod;
objProBE .Razon = raz;
objProBE .Direccion = dir;
objProBE .Telefono = tel;
objProBE .Distrito = dis;
objProBE .Representante = rep;
Response.Write(objProBL.ActualizarProveedor(objProBE));
gvProveedores.EditIndex = -1;
gvProveedores .DataSource = objProBL.getProveedores();
gvProveedores.DataBind();
}
示例8: GridViewMessages_RowUpdating
protected void GridViewMessages_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
using (var context = new ApplicationDbContext())
{
string contents = (this.GridViewMessages.Rows[e.RowIndex].FindControl("TextBoxContents") as TextBox).Text;
if (string.IsNullOrWhiteSpace(contents))
{
LabelErrorMessage.Text = "Contents cannot be empty";
e.Cancel = true;
return;
}
int messageId = Convert.ToInt32(this.GridViewMessages.DataKeys[e.RowIndex].Value);
var message = context.Messages.FirstOrDefault(m => m.Id == messageId);
if (message == null)
{
LabelErrorMessage.Text = "No message selected.";
e.Cancel = true;
return;
}
message.Contents = contents;
context.Entry<Message>(message).State = EntityState.Modified;
context.SaveChanges();
DataBind();
Response.Redirect(Request.RawUrl);
e.Cancel = true;
}
}
示例9: gvSchedule_RowUpdating
protected void gvSchedule_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
var tbScheduleType = gvSchedule.Rows[gvSchedule.EditIndex].Cells[1].Controls[0] as TextBox;
var tbDailyTime = gvSchedule.Rows[gvSchedule.EditIndex].Cells[3].Controls[0] as TextBox;
var tbMinutes = gvSchedule.Rows[gvSchedule.EditIndex].Cells[4].Controls[0] as TextBox;
var tbIsSystem = gvSchedule.Rows[gvSchedule.EditIndex].Cells[6].Controls[0] as TextBox;
var tbIsActive = gvSchedule.Rows[gvSchedule.EditIndex].Cells[7].Controls[0] as TextBox;
if (tbScheduleType != null && tbDailyTime != null && tbMinutes != null
&& tbIsSystem != null && tbIsActive != null)
{
try
{
var s = Schedule.Single(gvSchedule.DataKeys[gvSchedule.EditIndex].Value.ToString());
s.ScheduleType = tbScheduleType.Text.Trim();
s.DailyTime = Convert.ToInt32(tbDailyTime.Text.Trim());
s.Minutes = Convert.ToInt32(tbMinutes.Text.Trim());
s.IsSystem = Convert.ToBoolean(tbIsSystem.Text.Trim());
s.IsActive = Convert.ToBoolean(tbIsActive.Text.Trim());
s.Update();
}
catch (Exception ex)
{
ClientScript.RegisterClientScriptBlock(typeof (string), "failed",
$"alert('{ex.Message}');", true);
}
}
gvSchedule.EditIndex = -1;
BindData();
}
示例10: gvData_RowUpdating
protected void gvData_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try {
TextBox txtOldnoQty = (TextBox)gvData.Rows[e.RowIndex].FindControl("txtOldNoQty");
TextBox txtNewnoQty = (TextBox)gvData.Rows[e.RowIndex].FindControl("txtNewNoQty");
int rtn = 0;
if (txtNewnoQty.Text != "" && txtOldnoQty.Text != "")
{
//int.Parse(Request["id"])
rtn = PH_RateCalc.PH_RateCaclAdj_TransportInsert(AppCode.strConnDB, gvData.DataKeys[e.RowIndex].Value.ToString(), int.Parse(Request["id"]), int.Parse(txtOldnoQty.Text));
if (rtn > 0) rtn = PH_RateCalc.PH_RateCaclAdj_TransportInsert(AppCode.strConnDB, gvData.DataKeys[e.RowIndex].Value.ToString(), int.Parse(Request["id"]), int.Parse(txtNewnoQty.Text));
}
string message = rtn > 0 ? "Save Data Successfull" : "Save Data Not Successfull";
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alertmsg", "alert('" + message + "');", true);
gvData.EditIndex = -1;
DataBindTrans(true);
}
catch(Exception ex)
{
lblErr.Text = ex.Message;
PH_ExceptionManager.WriteError(ex.Message);
}
}
示例11: GridViewProsjektAnsvarligInsert_RowUpdating
protected void GridViewProsjektAnsvarligInsert_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = GridViewProsjektAnsvarligInsert.Rows[e.RowIndex];
try
{
string surname = e.NewValues["surname"].ToString();
string firstname = e.NewValues["firstname"].ToString();
string username = e.NewValues["username"].ToString();
string password = e.NewValues["password"].ToString();
string phone = e.NewValues["phone"].ToString();
string mail = e.NewValues["mail"].ToString();
DropDownList team = (DropDownList)row.FindControl("dropDownTeam");
DropDownList userType = (DropDownList)row.FindControl("dropDownBruker");
int teamID = Convert.ToInt32(team.SelectedValue);
int userTypeID = Convert.ToInt32(userType.SelectedValue);
string query = String.Format("INSERT INTO User (surname, firstname, password, username, phone, mail, teamID, groupID, aktiv) VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', {7}, {8})",
surname, firstname, password, username, phone, mail, teamID, userTypeID, "1");
db.InsertDeleteUpdate(query);
GridViewProsjektAnsvarligInsert.EditIndex = -1;
GridViewInsertEmpty();
beskjed.Text = "Ny brukeren er lagt til";
}
catch (Exception exception)
{
string error = exception.Message;
beskjed.Text = "Det oppsto en feil: " + error;
}
}
示例12: gridProduto_RowUpdating
protected void gridProduto_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
try
{
int index = gridProduto.EditIndex;
GridViewRow row = gridProduto.Rows[index];
Produto p = new Produto();
p.IdProduto = Convert.ToInt32(gridProduto.DataKeys[e.RowIndex].Value.ToString());
p.Nome = Convert.ToString(((TextBox)(row.Cells[2].Controls[0])).Text);
p.Preco = Convert.ToDecimal(((TextBox)(row.Cells[3].Controls[0])).Text);
p.Quantidade = Convert.ToInt32(((TextBox)(row.Cells[4].Controls[0])).Text);
p.Descricao = Convert.ToString(((TextBox)(row.Cells[5].Controls[0])).Text);
ProdutoDal d = new ProdutoDal();
d.Update(p);
lblMensagem.Text = "Produto Atualizado.";
gridProduto.EditIndex = -1;
gridBind();
}
catch (Exception ex)
{
lblMensagem.Text = "Erro ao atualizar Produto" + ex.Message;
}
}
示例13: complainGridView_RowUpdating
protected void complainGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int r = e.RowIndex;
Label t1 = (Label)complainGridView.Rows[r].FindControl("Label1");
TextBox t2 = (TextBox)complainGridView.Rows[r].FindControl("pNameTextBox");
TextBox t3 = (TextBox)complainGridView.Rows[r].FindControl("hostelTextBox");
TextBox t4 = (TextBox)complainGridView.Rows[r].FindControl("roomTextBox");
TextBox t5 = (TextBox)complainGridView.Rows[r].FindControl("categoryTextBox");
TextBox t6 = (TextBox)complainGridView.Rows[r].FindControl("summaryTextBox");
TextBox t7 = (TextBox)complainGridView.Rows[r].FindControl("priorityTextBox");
TextBox t8 = (TextBox)complainGridView.Rows[r].FindControl("contactTextBox");
bool flag = aManager.Update(t1.Text, t2.Text, int.Parse(t3.Text), int.Parse(t4.Text), t5.Text, t6.Text, t7.Text, t8.Text);
if (flag == true)
{
msgLabel.Text = "Update Successfully";
complainGridView.DataSource = aManager.ShowAllComplain();
complainGridView.EditIndex = -1;
complainGridView.DataBind();
}
else
{
msgLabel.Text = "Not Updated, Sorry!!!!!";
}
}
示例14: GridView1_RowUpdating
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string s = GridView1.DataKeys[e.RowIndex].Value.ToString();
TextBox name = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtName");
TextBox year = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtLaunchYear");
if (name.Text.Trim() == "" || year.Text.Trim() == "")
{
Label16.Text = "Insert data on the textbox.";
Label16.Visible = true;
}
else
{
Label16.Visible = false;
int q = Active_Record.Music.UpdateMusicInfo(Convert.ToInt32(s), name.Text, year.Text);
if (q == -1)
{
Label6.Text = "Error while updating music information. Try again later.";
Label6.Visible = true;
}
else if (q == -99)
{
Label15.Text = "An error occurred while loading the page. Try again later.";
Label15.Visible = true;
}
else
{
GridView1.EditIndex = -1;
BindGridData();
}
}
}
示例15: GridView1_RowUpdating
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
ControladorTecnico control = new ControladorTecnico();
GridViewRow fila = GridView1.Rows[e.RowIndex];
int id_orden = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0]);
string RutTec = (fila.FindControl("Label2") as Label).Text;
int ID_recep = Convert.ToInt32((fila.FindControl("Label3") as Label).Text);
string estado = (fila.FindControl("txtEstado") as TextBox).Text;
string observa = (fila.FindControl("txtObservacion") as TextBox).Text;
int precio = Convert.ToInt32((fila.FindControl("txtPrecio") as TextBox).Text);
string estadopago = (fila.FindControl("txtEstadoPago") as TextBox).Text;
int tipo = Convert.ToInt32((fila.FindControl("Label4") as Label).Text);
Orden_Trabajo orden = new Orden_Trabajo
{
ID_Orden = id_orden,
RUT_Usuario = RutTec,
ID_Recepcion = ID_recep,
Estado= estado,
Observacion=observa,
Precio=precio,
Estado_pago=estadopago,
ID_TipoPago = tipo
};
control.EditarOrden(orden);
GridView1.EditIndex = -1;
cargarBOX();
}