Posts Tagged ‘asp.net’

Sys.WebForms.PageRequestManager Class

My new favorite ASP.Net web form tool

Sys.WebForms.PageRequestManager Class.NET Framework 4 Other Versions 8 out of 11 rated this helpful – Rate this topicManages partial-page updates of server UpdatePanel controls in the browser, and defines properties, events, and methods that can be used to customize a Web page by using client script.Namespace: Sys.WebFormsInherits: Nonevar prm = Sys.WebForms.PageRequestManager.getInstance;Constructor

via Sys.WebForms.PageRequestManager Class.

ASP.Net Razor and VB

Find a VB syntax reference for ASP.Net Razor is proving difficult. Most Razor samples are C#. This tutorial is the best that I’ve found so far.

http://www.asp.net/webmatrix/tutorials/asp-net-web-pages-visual-basic

Continue reading »

"The breakpoint will not currently be hit" "The source code is different then the original version"

Big thanks to ThatOneDeveloper! His post about fixing ASP.Net debugger was a big help.

http://development.thatoneplace.net/2009/04/breakpoint-will-not-currently-be-hit.html

“The breakpoint will not currently be hit. The source code is different then the original version”

So to fix the problem:

  1. Close out Visual Studio and make sure any instances of ASP.NET development server are closed as well.
  2. Delete everything from “C:\Windows\Microsoft.NET\Framework\v.2.0.50727\Temporary ASP.NET Files” (where v.2.0.50727 is the version of the .NET Framework your site is running on.)

cat
see more Lolcats and funny pictures

Linq to SQL DataContext.Attach Heartaches

I was stunned that Microsoft has made disconnected updates with Linq so difficult. Didn’t they realize that a large chunk of their developers would be using ASP.NET or WCF?

Some of the more cryptic errors are:

“An entity can only be attached as modified without original state if it declares a version member or does not have an update check policy.”

“An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext.  This is not supported.”

Changing update policies didn’t work. Adding timestamp columns didn’t work. Crying, while it felt good, didn’t work. What worked? A couple hours of forum crawling just to find one good post, here. Sidar Ok, you are my hero of the day. If I was the ruler of a small country, August 18th would be Sidar Ok Day.

Happiness Returns

This gist of it is to turn off object tracking for the retrieval data context. You would think that there would be no tracking involved after that data context is disposed of, but c’est la vie. Could be that some garbage disposal needed to happen or Linq’s Table attribute is adding some wierd exentsibility. I dunno.

In this sample, I’m using a simple AccountType table. I am retrieving, disconnecting, modifing, and saving.

Sample Code

Sub DisconnectedAccountTypeUpdate()

Dim acctType As Linq2SqlTestApp.DAL.AccountType
Dim originalAcctType As Linq2SqlTestApp.DAL.AccountType

‘Retrieve and Disconnect
Using dc As New Linq2SqlTestApp.DAL.MyDatabase(My.Settings.MyDatabaseConnectionString)
dc.Log = Console.Out
dc.ObjectTrackingEnabled = False
acctType = dc.GetTable(Of AccountType).Single(Function(g) g.AccountType1 = “RESOLD”)
originalAcctType = dc.GetTable(Of AccountType).Single(Function(g) g.AccountType1 = “RESOLD”)
End Using

‘Modify disconnected object.
acctType.OrderBy += 1

‘Update
Using dc As New Linq2SqlTestApp.DAL.MyDatabase(My.Settings.MyDatabaseConnectionString)
dc.Log = Console.Out
dc.AccountType.Attach(acctType, originalAcctType)
dc.SubmitChanges()
End Using

End Sub