本文整理汇总了C#中System.Web.UI.WebControls.DataListCommandEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DataListCommandEventArgs类的具体用法?C# DataListCommandEventArgs怎么用?C# DataListCommandEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataListCommandEventArgs类属于System.Web.UI.WebControls命名空间,在下文中一共展示了DataListCommandEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DlCommandItem
public void DlCommandItem(object server, DataListCommandEventArgs e)
{
if (e.CommandName == "StudentDetailInfo")
{
Response.Redirect(String.Format("~/InstructorSite/frmViewStudentGrade.aspx?sid={0}", ((Label)e.Item.FindControl("lblStudentID")).Text));
}
}
示例2: DataListEmpleados_ItemCommand
protected void DataListEmpleados_ItemCommand(object source, DataListCommandEventArgs e) {
if(e.CommandName == "verDetalles") {
string empleadoID = e.CommandArgument.ToString();
int indice = e.Item.ItemIndex;
DataListItem itemSeleccionado = DataListEmpleados.Items[indice];
Literal l1 = itemSeleccionado.FindControl("Literal1") as Literal;
l1.Visible = true;
SqlConnection conexion = new SqlConnection(cadenaConexion);
SqlCommand consultaTelefono = new SqlCommand ("SELECT TelfMobil FROM Empleados WHERE EmpleadoID = @EmpleadoID", conexion);
consultaTelefono.Parameters.Add("@EmpleadoID", SqlDbType.Int);
consultaTelefono.Parameters["@EmpleadoID"].Value = empleadoID;
try {
conexion.Open();
SqlDataReader reader = consultaTelefono.ExecuteReader();
if(reader.Read()) {
l1.Text += "<strong>" + reader["TelfMobil"] + "</strong>";
}
reader.Close();
}
catch (SqlException ex) {
Response.Write("Ha ocurrido un error en la consulta: " + ex.Message);
}
finally {
conexion.Close();
}
}
}
示例3: DataList1_ItemCommand
public void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName.Equals("call"))
{
DataListItem item = (DataListItem)(((Button)(e.CommandSource)).NamingContainer);
text = ((TextBox)item.FindControl("TextBox1")).Text;
Response.Write(text+"text1");
}
UploadAttribute.WebService1 S1 = new UploadAttribute.WebService1();
S1.Credentials = System.Net.CredentialCache.DefaultCredentials;
String a;
a = S1.deleteTable(text);
string imgurl = Server.MapPath("~/storage/"+text + "");
System.IO.File.Delete(imgurl);
if (a.Equals("Bought"))
{
Response.Write("Delete Successful");
Response.Write(text);
}
else
Response.Write("Delete UnSuccessful");
}
示例4: DataList1_ItemCommand
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "btnDel")
{
sb.delSpeak((int)e.CommandArgument);
}
}
示例5: DataList1_ItemCommand
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if(e.CommandName.ToString()=="Cmdedit")
{
DataList1.EditItemIndex = e.Item.ItemIndex;
FillData();
}
else if(e.CommandName.ToString()=="CmdCancel")
{
DataList1.EditItemIndex = -1;
FillData();
}
else if(e.CommandName.ToString()=="CmdUpadate")
{
Label leno = (Label)e.Item.FindControl("lblempno");
string empno =leno.Text;
Response.Write(empno);
TextBox t1 = (TextBox)e.Item.FindControl("txtempname");
string ename = t1.Text;
TextBox t2 = (TextBox)e.Item.FindControl("txtsalary");
Double salary =Double.Parse( t2.Text);
con.Open();
string query="update emp set Empname='"+ename+"',salary='"+salary+"' where empno='"+empno+"'";
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteNonQuery();
con.Close();
DataList1.EditItemIndex = -1;
FillData();
}
}
开发者ID:ananth039,项目名称:Anantha-Kumar-.net-Practice-programs,代码行数:31,代码来源:datalist+control+example.aspx.cs
示例6: DataList1_UpdateCommand
protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)
{
//if (base.level == ((int)Util.Enum.UserSysLevel.Experience).ToString() || base.isOverTime)
//{
// Alert(this, "体验版用户不能具备此功能!");
// return;
//}
int id = 0;
try
{
id = Convert.ToInt32(DataList1.DataKeys[e.Item.ItemIndex]);
}
catch (Exception ex)
{
Alert(this, "ID格式错误"+ex.Message);
return;
}
string context = ((TextBox)e.Item.FindControl("txtContext")).Text.Trim();
if (context.Length == 0)
{
Alert(this, "请填写好评再保存");
return;
}
autoTraderateAction.UpdateContext(id,context);
DataList1.EditItemIndex = -1;
BindDatalist();
}
示例7: StudentData_UpdateCommand
protected void StudentData_UpdateCommand(object source, DataListCommandEventArgs e)
{
if (Page.IsValid)
try
{
StudentDataSource.UpdateParameters["StuId"].DefaultValue = HttpContext.Current.User.Identity.Name;
// Build update parametter from controls
StudentDataSource.UpdateParameters["Address"].DefaultValue = ((TextBox)e.Item.FindControl("txtAddress")).Text;
StudentDataSource.UpdateParameters["Phone"].DefaultValue = ((TextBox)e.Item.FindControl("txtPhone")).Text;
StudentDataSource.UpdateParameters["Email"].DefaultValue = ((TextBox)e.Item.FindControl("txtEmail")).Text;
StudentDataSource.UpdateParameters["Account"].DefaultValue = ((TextBox)e.Item.FindControl("txtAccount")).Text;
StudentDataSource.Update();
// Rebind to control
StudentData.EditItemIndex = -1;
StudentData.DataBind();
if (!string.IsNullOrEmpty(Settings["Email"] as string))
this.CompareAndSendInfo(e.Item);
}
catch (Exception ex)
{
// Notice error to the user
((Label)e.Item.FindControl("StudentFailureText")).Text = ex.Message;
}
}
示例8: DatalistDVD_ItemCommand
protected void DatalistDVD_ItemCommand(object source, DataListCommandEventArgs e)
{
if(e.CommandName == "DVDEditOpen")
{
DatalistDVD.EditItemIndex = e.Item.ItemIndex;
bindDatalist();
}
else if(e.CommandName == "DVDEditSave")
{
int DVDID = Convert.ToInt32(e.CommandArgument);
TextBox TextBoxTitle = (TextBox)e.Item.FindControl("TextBoxTitle");
string newTitle = TextBoxTitle.Text;
TextBox TextBoxArtist = (TextBox)e.Item.FindControl("TextBoxArtist");
string newArtist = TextBoxArtist.Text;
TextBox TextBoxRating = (TextBox)e.Item.FindControl("TextBoxRating");
string newRating = TextBoxRating.Text;
TextBox TextBoxPrice = (TextBox)e.Item.FindControl("TextBoxPrice");
string newPrice = TextBoxPrice.Text;
sqlUpdateItem(DVDID, newTitle, newArtist, newRating, newPrice);
DatalistDVD.EditItemIndex = -1;
bindDatalist();
}
else if(e.CommandName == "DVDEditCancel")
{
DatalistDVD.EditItemIndex = -1;
bindDatalist();
}
}
示例9: dlistUrunler_ItemCommand
protected void dlistUrunler_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "detay")
{
Response.Redirect("Details.aspx?id=" + Convert.ToInt32(e.CommandArgument));
}
else if (e.CommandName == "sepet")
{ // 13.10 ******************
dlistUrunler.EditItemIndex = e.Item.ItemIndex;
if (Session["sepet"] == null)
{
Session["sepet"] = spt.YeniSepet();
}
DataTable dt = (DataTable)Session["sepet"];
DataRow dr;
dr = dt.NewRow();
dr["UrunID"] = Convert.ToInt32(dlistUrunler.SelectedValue);
Label Adi = (Label)e.Item.FindControl("lblUrunAdi");
dr["urunAd"] = Adi.Text;
TextBox Adet = (TextBox)e.Item.FindControl("txtAdet");
dr["Adet"] = Convert.ToInt32(Adet.Text);
Label Fiyat = (Label)e.Item.FindControl("lblUrunFiyat");
dr["fiyat"] = Convert.ToDecimal(Fiyat.Text);
dr["tutar"] = Convert.ToInt32(Adet.Text) * Convert.ToDecimal(Fiyat.Text);
dt.Rows.Add(dr);
Session["sepet"] = dt;
Response.Redirect("Sepet.aspx");
}
}
示例10: repCategories_ItemCommand
//private void repCategories_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
protected void repCategories_ItemCommand(object source, DataListCommandEventArgs e)
{
try
{
if(e.CommandName == "Select")
{
ViewState["CatId"] = e.CommandArgument;
pnlEnterIssue.Visible = true;
pnlSelectCategory.Visible = false;
pnlViewIssues.Visible = false;
tbNotes.Text = "";
}
}
catch(Exception ex)
{
_functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
Session["lastpage"] = CurrentPage;
Session["error"] = ex.Message;
Session["error_report"] = ex.ToString();
Response.Redirect("error.aspx", false);
}
finally
{
}
}
示例11: dl_music_ItemCommand
protected void dl_music_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "SongInfo")
{
Response.Redirect("MusicView.aspx");
}
}
示例12: DataListUsers_UpdateCommand
protected void DataListUsers_UpdateCommand(object source, DataListCommandEventArgs e)
{
SqlDataSourceUsers.UpdateParameters["userID"].DefaultValue = DataListUsers.DataKeys[e.Item.ItemIndex].ToString();
SqlDataSourceUsers.UpdateParameters["blokada"].DefaultValue = e.CommandArgument.ToString();
SqlDataSourceUsers.Update();
}
示例13: DataListProducts_ItemCommand
public void DataListProducts_ItemCommand(object source, DataListCommandEventArgs e)
{
/*
var list = (List<Tuple<string, int>>)(Session["cartList"]);
foreach (var i in list)
{
if (i.Item1 == e.CommandName)
{
list.Add(new Tuple<string, int>(e.CommandName, 1));
break;
}
}
Session["cartList"] = list;
foreach (var x in prods)
{
if (e.CommandName == x.Prodcd)
{
x.Qty++;
x.Total = x.Qty * x.Price;
DataListCartItems.DataSource = prods;
DataListCartItems.DataBind();
break;
}
}
* */
}
示例14: DataList1_ItemCommand
protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "cate")
{
Response.Redirect("~/Tour.aspx?cateid=" + e.CommandArgument + "&Country=" + Request.QueryString["country"]);
}
}
示例15: dlstTs_ItemCommand
protected void dlstTs_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "sepet")
{
dlstTs.SelectedIndex = e.Item.ItemIndex;
if (Session["sepet"] == null)
{
Session["sepet"] = spt.YeniSepet();
}
DataTable dt = (DataTable)Session["sepet"];
DataRow dr;
dr = dt.NewRow();
dr["urunId"] = Convert.ToInt32(dlstTs.SelectedValue);
Label UrunAdi = (Label)e.Item.FindControl("lblTs");
dr["urunadi"] = UrunAdi.Text;
Label Fiyat = (Label)e.Item.FindControl("lblFiyat");
dr["birimfiyat"] = Convert.ToDecimal(Fiyat.Text);
TextBox Adet = (TextBox)e.Item.FindControl("txtAdet");
dr["adet"] = Convert.ToInt32(Adet.Text);
dr["tutar"] = Convert.ToInt32(Adet.Text) * Convert.ToDecimal(Fiyat.Text);
dt.Rows.Add(dr);
Session["sepet"] = dt;
Response.Redirect("Sepet.aspx");
}
else
if (e.CommandName == "detay")
{
Response.Redirect("Detay.aspx?ID=" + Convert.ToInt32(e.CommandArgument));
}
}