Unable to serialize the session state

Can we see the “Gebruiker” class? There error seems straightforward enough. Gebruiker is not attributed as being Serializable therefore it can’t be placed in Session for StateServer and SQLServer modes. EDIT: After looking at the code you linked in, yes, it’s probably because the class isn’t serializable. The LINQ generated class should be a partial … Read more

Full postback triggered by LinkButton inside GridView inside UpdatePanel

You need to register each and every LinkButton as an AsyncPostBackTrigger. After each row is bound in your GridView, you’ll need to search for the LinkButton and register it through code-behind as follows: protected void OrderGrid_RowDataBound(object sender, GridViewRowEventArgs e) { LinkButton lb = e.Row.FindControl(“MarkAsCompleteButton”) as LinkButton; ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(lb); } This also requires that ClientIDMode=”AutoID” be set … Read more

How to convert datetime to timestamp using C#/.NET (ignoring current timezone)

At the moment you’re calling ToUniversalTime() – just get rid of that: private long ConvertToTimestamp(DateTime value) { long epoch = (value.Ticks – 621355968000000000) / 10000000; return epoch; } Alternatively, and rather more readably IMO: private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); … private static long ConvertToTimestamp(DateTime value) { … Read more

MVC3 Valums Ajax File Upload

I figured it out. this works in IE and Mozilla. [HttpPost] public ActionResult FileUpload(string qqfile) { var path = @”C:\\Temp\\100\\”; var file = string.Empty; try { var stream = Request.InputStream; if (String.IsNullOrEmpty(Request[“qqfile”])) { // IE HttpPostedFileBase postedFile = Request.Files[0]; stream = postedFile.InputStream; file = Path.Combine(path, System.IO.Path.GetFileName(Request.Files[0].FileName)); } else { //Webkit, Mozilla file = Path.Combine(path, qqfile); … Read more

Perform Button click event when user press Enter key in Textbox

Put your form inside an asp.net panel control and set its defaultButton attribute with your button Id. See the code below: <asp:Panel ID=”Panel1″ runat=”server” DefaultButton=”Button1″> <asp:UpdatePanel ID=”UpdatePanel1″ runat=”server” UpdateMode=”Conditional”> <ContentTemplate> <asp:TextBox ID=”TextBox1″ runat=”server”></asp:TextBox> <asp:Button ID=”Button1″ runat=”server” onclick=”Button1_Click” Text=”Send” /> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> Hope this will help you…

Inline code in head tag – ASP.NET

The reason the output is being rendered like so: href=”https://stackoverflow.com/questions/8104268/&lt;%=Config.ResourcesDomain %>/images/style.css” Is because ASP.NET is treating the link as an HtmlLink control, and rendering the contents of the href attribute as a literal. This is a strange quirk of marking the head section as a server control, where certain elements are treated as server controls … Read more