- 爱易网页
-
C#教程
- 输入字符串格式不正确,该怎么解决
日期:2014-05-18 浏览次数:21365 次
输入字符串格式不正确
[code=C#][/code]protected void Button_Save_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
try
{
Tab_ProductEnti productenti = new Tab_ProductEnti();
productenti.ProductTitle = this.txtproductTitle.Text;
productenti.DefaultPic = this.txtDefaultPic.Text;
int parentID = int.Parse(this.hfParent.Value.ToString());
productenti.NumberID = this.txtnumberid.Text;
if (parentID == 0)
{
PageInfo("请选择商标类型再添加内容", "Product_Add.aspx");
return;
}
productenti.ParentID = parentID;
productenti.OrderID = int.Parse(txtorderid.Text.Trim());
productenti.KeyWord = txtkeyword.Text;
productenti.Content = this.FCKeditor1.Value;
productenti.Price = int.Parse(this.txtprice.Text);
productenti.Description = this.txtDescription.Text;
productenti.AddTime = DateTime.Now;
productenti.BeginTime = DateTime.Parse(txtbegintime.Text);
productenti.IsPass = ckIsPass.Checked;
productenti.IsRed = isred.Checked;
productenti.IsSpe = isspe.Checked;
productenti.Itsown = itsown.Checked;
productenti.BrandID = int.Parse(lanmu.SelectedValue);
if (((Button)sender).Text == "保存")
{
string savePath = "Product/" + GetClassDirectory(parentID.ToString()) + "/" + DirFile.GetDateDir() + "/";
string fileName = DirFile.GetDateFile();
string fileEXName = ".html";
productenti.SavePath = savePath;
productenti.FileName = fileName;
productenti.FileExName = fileEXName;
if (Tab_Product.Add(productenti) == 1)
{
CreateHmtl(productenti);
PageInfo("添加成功", "Product_List.aspx");
}
else
{
PageInfo("添加失败", "Product_Add.aspx");
}
}
else if (((Button)sender).Text == "保存修改")
{
string ID = Request.QueryString["ID"];
productenti.SavePath = ViewState["SavePath"].ToString();
productenti.FileName = ViewState["FileName"].ToString();
productenti.FileExName = ViewState["FileExName"].ToString();
if (ID == null || ID.Equals(""))
{
PageInfo("参数错误", "Product_List.aspx");
}
else
{
productenti.ID = int.Parse(ID);