PDA

View Full Version : [CLOSED] TimeStamp Post problem



YilportDeveloper
Jan 28, 2015, 2:35 PM
Hello

I am developing software with MVC5 and ext.net 2.5.

I use the timestamp value for optimistic concurrency Entity framework that value byte [] array.

I 'd like to post this value. I can post on the html.beginform. But cant Html.X.FormPanel.

I get an error, illegal characters in 64-bit .....

How can I post, byte[] array value to controller.

Burhan

geoffrey.mcgill
Jan 28, 2015, 3:56 PM
Hello,

Please post a simplified code sample demonstrating the scenario. Please remove all code that is not directly related to the problem.

The forum guidelines provide lots of tips and recommendations for posting in the forums:

http://forums.ext.net/showthread.php?10205-More-Information-Required

YilportDeveloper
Jan 29, 2015, 8:42 AM

Daniil
Jan 29, 2015, 5:38 PM
Hi @YilportDeveloper,

Please don't forget to wrap the code in
tags.

As for the issue, I tested with the example below and could not reproduce. A TimeStamp submitted from client reaches an entity's TimeStamp property in the Submit action.

View
[CODE]@model Work3MVC.Controllers.TestEntity

@{
var X = Html.X();
}

<!DOCTYPE html>
<html>
<head>
<title>Ext.Net.MVC v3 Example</title>
</head>
<body>
@X.ResourceManager()

@(X.FormPanel()
.Width(300)
.Items(
X.TextFieldFor(m => m.Text),
X.HiddenFor(m => m.TimeStamp)
)
.Buttons(
X.Button()
.Text("Submit")
.Icon(Icon.Disk)
.DirectClickAction("Submit")
)
)
</body>
</html>


Controller and Model

public class TestEntity
{
public string Text { get; set; }

public DateTime TimeStamp { get; set; }
}

public class RazorController : Controller
{
public ActionResult Index()
{
return this.View(new TestEntity
{
Text = "Some Text",
TimeStamp = DateTime.Now
});
}

public ActionResult Submit(TestEntity entity)
{
X.Msg.Alert("Submitted", string.Format("Text: {0}, TimeStamp: {1}", entity.Text, entity.TimeStamp.ToString())).Show();
return this.Direct();
}
}

YilportDeveloper
Jan 29, 2015, 5:55 PM
Dear daniel,

Timestamp type is a byte[] array.

We use Microsoft SQL timestamp type for entity Framework concurrency check.

SQL provide timestamp type and c# hold byte.[] array

Daniil
Jan 29, 2015, 6:09 PM
Probably, it is better to deal with a Base64 string of a byte[] array.
http://stackoverflow.com/questions/6754551/mvc3-posting-byte-array-to-a-controller-database-rowversion