本文整理汇总了C#中System.Web.UI.WebControls.DetailsViewInsertEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DetailsViewInsertEventArgs类的具体用法?C# DetailsViewInsertEventArgs怎么用?C# DetailsViewInsertEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DetailsViewInsertEventArgs类属于System.Web.UI.WebControls命名空间,在下文中一共展示了DetailsViewInsertEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddContactDetailsView_ItemInserting
protected void AddContactDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
string firstName = e.Values["FirstName"].ToString();
string lastName = e.Values["LastName"].ToString();
string city = e.Values["City"].ToString();
string country = e.Values["Country"].ToString();
string phone = e.Values["PhoneNumber"].ToString();
string email = string.Empty;
if (e.Values["Email"] != null)
email = e.Values["Email"].ToString();
else
{
email = "";
}
try
{
AddressBookRepository context = new AddressBookRepository();
context.InsertContact(firstName, lastName, city, country, phone, email, User.Identity.Name);
lblMessage.Text = "Contact Added: " + e.Values[0] + e.Values[1];
}
catch (OptimisticConcurrencyException ocex)
{
lblMessage.Text = ocex.ToString();
}
catch (Exception)
{
lblMessage.Text = "An error occured on inserting new contact. Try again.";
}
}
示例2: AccountDetailsView_ItemInserting
protected void AccountDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
e.Values["CreatedTime"] = DateTime.Now;
e.Values["ModifiedTime"] = DateTime.Now;
e.Values["CompanyID"] = Convert.ToInt32(Session["CompanyID"]);
e.Values["CreatedBy"] = Convert.ToInt64(Session["UserID"]);
}
示例3: InsertItem
protected void InsertItem(object sender, DetailsViewInsertEventArgs e)
{
TextBox question = (TextBox)DetailsView1.FindControl("NewPollQuestion");
Snitz.BLL.Polls.AddTopicPoll(-1, question.Text, new SortedList<int, string>());
Response.Redirect(Request.RawUrl);
}
示例4: CampaignDetailsView_ItemInserting
protected void CampaignDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
long userid;
if (String.IsNullOrEmpty(Session["CompanyID"].ToString())) { return; }
else
{
e.Values["CompanyID"] = Convert.ToInt32(Session["CompanyID"]);
}
if (String.IsNullOrEmpty(Session["UserID"].ToString())) { return; }
else
{
userid = Convert.ToInt64(Session["UserID"]);
}
if (Convert.ToInt32(CampaignStatusDropDownList.SelectedValue) == 0)
{
e.Values["CampaignStatusID"] = null;
}
else { e.Values["CampaignStatusID"] = CampaignStatusDropDownList.SelectedValue; }
if (Convert.ToInt32(CampaignTypeDropDownList.SelectedValue) == 0) { e.Values["CampaignTypeID"] = null; }
else { e.Values["CampaignTypeID"] = CampaignTypeDropDownList.SelectedValue; }
if (Convert.ToInt32(CurrencyDropDownList.SelectedValue) == 0) { e.Values["CurrencyID"] = null; }
else { e.Values["CurrencyID"] = CurrencyDropDownList.SelectedValue; }
if (Convert.ToInt32(AssignedUserDropDownList.SelectedValue) == 0) { e.Values["AssignedUserID"] = null; }
else { e.Values["AssignedUserID"] = AssignedUserDropDownList.SelectedValue; }
if (Convert.ToInt32(TeamDropDownList.SelectedValue) == 0) { e.Values["TeamID"] = null; }
else { e.Values["TeamID"] = TeamDropDownList.SelectedValue; }
e.Values["CreatedBy"] = userid;
e.Values["CreatedTime"] = DateTime.Now;
e.Values["ModifiedBy"] = userid;
e.Values["ModifiedTime"] = DateTime.Now;
}
示例5: DetailsView1_ItemInserting
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
CatalogManager manager = new CatalogManager();
RequisitionItem item = new RequisitionItem();
item.StationeryID = Convert.ToInt32(((DropDownList)DetailsView1.FindControl("stDDL")).SelectedValue);
item.QuantityRequested = Convert.ToInt32(((TextBox)DetailsView1.FindControl("stTextBox")).Text);
item.QuantityIssued = 0;
item.Price = 0;
if (requisition.RequisitionItems.Count == 0)
{
requisition.RequisitionItems.Add(item);
}
else
{
foreach (var req in requisition.RequisitionItems)
{
if (item.StationeryID == req.StationeryID)
{
req.QuantityRequested += item.QuantityRequested;
break;
}
else
{
requisition.RequisitionItems.Add(item);
break;
}
}
}
GridDataBind();
}
开发者ID:chutinhha,项目名称:logic-university-stationery-store-inventory-system,代码行数:33,代码来源:StationeryRequest.aspx.cs
示例6: DetailsView2_ItemInserting
protected void DetailsView2_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
XmlDocument xdoc = XmlDataSource4.GetXmlDocument();
XmlElement FeedsList = xdoc.SelectSingleNode("/feeds") as XmlElement;
XmlElement checkFeed = xdoc.SelectSingleNode("/feeds/feed[@name='" + e.Values["name"].ToString() + "']") as XmlElement;
if (checkFeed == null)
{
XmlElement oFeed = xdoc.CreateElement("feed");
XmlAttribute name = xdoc.CreateAttribute("name");
XmlAttribute url = xdoc.CreateAttribute("url");
name.Value = e.Values["name"].ToString();
url.Value = e.Values["url"].ToString();
oFeed.Attributes.Append(name);
oFeed.Attributes.Append(url);
FeedsList.AppendChild(oFeed);
XmlDataSource4.Save();
e.Cancel = true;
}
Response.Redirect(Request.RawUrl);
}
示例7: DetailsView1_ItemInserting
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
DropDownList dlist = DetailsView1.FindControl("ddlDepartment") as DropDownList;
TextBox txtName = DetailsView1.FindControl("txtLoginName") as TextBox;
TextBox txtPwd = DetailsView1.FindControl("txtPassword") as TextBox;
CheckBox chkSuper = DetailsView1.FindControl("chkSuperAdmin") as CheckBox;
if (dlist == null || txtName == null || txtPwd == null || chkSuper == null)
{
Response.Write("出错,不能获取相关控件");
return;
}
int did=int.Parse(dlist.SelectedValue);
AdminUserInfo a = new AdminUserInfo();
a.LoginName = txtName.Text;
a.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtPwd.Text, "SHA1");
a.DepartmentID = did;
a.IsSuperAdmin = chkSuper.Checked;
AdminUser.InsertAdminUser(a);
this. ClientScript.RegisterStartupScript(this.GetType(), "Hint", "<script>alert('成功添加管理员信息')</script>");
DetailsView1.Visible = false;
GridView1.DataBind();
e.Cancel = true;
}
示例8: dtlvCustomer_ItemInserting
/// <summary>
/// Handles the ItemInserting event of dtlvCustomer.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The DetailsViewInsertEventArgs.</param>
protected void dtlvCustomer_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
if (this.IsValid)
{
try
{
Poco::ICustomer newCustomer = this.GetCustomerObject();
using (Bll::ICustomer blCustomer = new Bll::Customer())
{
blCustomer.Create(newCustomer);
}
Response.Redirect("~/Customer.aspx"); // Go and show all data.
}
catch (SqlException ex)
{
Response.Write(ex.ToString());
}
catch (ObjectDisposedException ex)
{
Response.Write(ex.ToString());
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
}
示例9: ExamDetailsView_ItemInserting
protected void ExamDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
if (tol > (dur * 0.2))
{
ShowMessageBox("Tolerance should be less than or equal to 20% of the duration.");
ExamDetailsView.FindControl("txtTolerance").Focus();
e.Cancel = true;
}
}
示例10: LeadDetailsView_ItemInserting
protected void LeadDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
e.Values["LeadSourceID"] = leadSourcesDropDownList.SelectedValue;
e.Values["FirstName"] = contactsDropDownList.SelectedItem;
e.Values["AccountID"] = accountsDropDownList.SelectedValue;
e.Values["TeamID"] = teamsDropDownList.SelectedValue;
e.Values["AssignedUserID"] = assignedToUsersDropDownList.SelectedValue;
e.Values["LeadStatusID"] = leadStatusesDropDownList.SelectedValue;
}
示例11: DetailsView1_ItemInserting
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
/* Control file = DetailsView1.FindControl("FileUpload1");
FileUpload fileUp;
fileUp = ((FileUpload)file);
fileUp.SaveAs(fileUp.FileName);
*/
}
示例12: DetailsView1_ItemInserting
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
SqlDataSource1.InsertParameters["moduleCode"].DefaultValue = ((TextBox)DetailsView1.Rows[0].Cells[1].FindControl("TextBox1")).Text;
SqlDataSource1.InsertParameters["name"].DefaultValue = ((TextBox)DetailsView1.Rows[1].Cells[1].FindControl("TextBox2")).Text;
SqlDataSource1.InsertParameters["GPA"].DefaultValue = ((RadioButtonList)DetailsView1.Rows[2].Cells[1].FindControl("RadioButtonList3")).SelectedItem.Text;
SqlDataSource1.InsertParameters["credits"].DefaultValue = ((TextBox)DetailsView1.Rows[3].Cells[1].FindControl("TextBox3")).Text;
SqlDataSource1.InsertParameters["compulary"].DefaultValue = ((RadioButtonList)DetailsView1.Rows[4].Cells[1].FindControl("RadioButtonList4")).SelectedItem.Text;
SqlDataSource1.Insert();
}
示例13: ContactDetailsView_ItemInserting
protected void ContactDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
e.Values["AccountID"] = AccountDropDownList.SelectedValue;
e.Values["TeamID"] = TeamDropDownList.SelectedValue;
e.Values["ReportsTo"] = ReportToDropDownList.SelectedValue;
e.Values["AssignedTo"] = AssaigendToDropDownList.SelectedValue;
e.Values["LeadSourcesID"] = LeadSourcesDropDownList.SelectedValue;
e.Values["CreatedTime"] = DateTime.Now;
e.Values["ModifiedTime"] = DateTime.Now;
e.Values["CompanyID"] =7;
}
示例14: QuestionDetailsView_ItemInserting
protected void QuestionDetailsView_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
ApplyFilter();
//question owner
Question_SqlDataSource.InsertParameters["createdBy"].DefaultValue = HttpContext.Current.User.Identity.Name.ToString();
//question image file
FileUpload fUpload = (FileUpload)QuestionDetailsView.Rows[0].FindControl("imageFileUpload");
String txtPath = "~/QuestionFiles/" + fUpload.FileName;
Question_SqlDataSource.InsertParameters["questionFilePath"].DefaultValue = txtPath;
LblError.Text = "";
}
示例15: DetailsView1_ItemInserting
protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
if (e.Values["FileName"] != null)
{
string fileName = e.Values["FileName"].ToString();
string newFileName = string.Format("{0}{1}{2}", Path.GetFileNameWithoutExtension(fileName),
Guid.NewGuid().ToString().Substring(0, 5), Path.GetExtension(fileName));
e.Values["GameImage"] = newFileName;
SaveLogoFile(newFileName);
}
}