예제 #1
0
 protected void ShipZoneGrid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Copy")
     {
         int      shipZoneId = (int)ShipZoneGrid.DataKeys[Int32.Parse(e.CommandArgument.ToString())].Value;
         ShipZone copy       = ShipZone.Copy(shipZoneId, true);
         if (copy != null)
         {
             // THE NAME SHOULD NOT EXCEED THE MAX 255 CHARS
             String newName = "Copy of " + copy.Name;
             if (newName.Length > 255)
             {
                 newName = newName.Substring(0, 252) + "...";
             }
             copy.Name = newName;
             copy.Save();
             ShipZoneGrid.DataBind();
         }
     }
 }