Customizing Style of RadGrid Edit Items#

A developer wanted to customize his “edit” form with a telerik rad grid, and we found it less than simple to change the textboxes and other edit controls to make them more narrow, and/or other customizations.

 

I did some research and came across a few different technique for doing this that I am going to share with everyone.

 

Template Columns

The first option, which is the one he used because it is the easiest, is to convert your columns to “template columns.”  Converting columns changes:

 

<telerik:GridBoundColumn DataField="EmployeeEmail" DataType="System.Int32" HeaderText="EmployeeEmail"

SortExpression="EmployeeEmail" UniqueName="EmployeeEmail" />

 

To this:

 

<telerik:GridTemplateColumn DataField="EmployeeEmail"

    HeaderText="EmployeeEmail" SortExpression="EmployeeEmail"

    UniqueName="EmployeeEmail">

    <EditItemTemplate>

        <asp:TextBox ID="EmployeeEmailTextBox" runat="server"

            Text='<%# Bind("EmployeeEmail") %>'></asp:TextBox>

    </EditItemTemplate>

    <ItemTemplate>

        <asp:Label ID="EmployeeEmailLabel" runat="server"

            Text='<%# Eval("EmployeeEmail") %>'></asp:Label>

    </ItemTemplate>

</telerik:GridTemplateColumn>

 

 

As you can see, this gives you control over the actual textbox item that will be displayed when you are in edit mode.

 

But using template columns can also be a bit of a pain, because you losing some of the simplicity that you had before when you simply allowed the rad grid to deal with the details of the display/edit cell items.  This also complicates things when you try to do anything in the ItemDataBound or ItemCreated events on the rad grid.  You can’t just grab the column, you have to dig deeper, looking for the contained child controls to find your actual edit control.

 

ItemDataBound

 

    Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound

        If TypeOf e.Item Is GridEditableItem And e.Item.IsInEditMode Then

            Dim editItem As GridEditableItem = e.Item

            If TypeOf editItem.Item("EmployeeId").Controls(0) Is TextBox Then

                CType(editItem.Item("EmployeeId").Controls(0), TextBox).Width = 30

            End If

        End If

    End Sub

 

 

In this example, I am setting the width of the EmployeeId textbox to only 30px.

 

 

CreateColumnEditor

 

    Protected Sub RadGrid1_CreateColumnEditor(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCreateColumnEditorEventArgs) Handles RadGrid1.CreateColumnEditor

        If TypeOf e.ColumnEditor Is GridTextBoxColumnEditor Then

            If e.Column.UniqueName = "FirstName" Then

                CType(e.ColumnEditor, GridTextBoxColumnEditor).TextBoxStyle.Width = 30

                CType(e.ColumnEditor, GridTextBoxColumnEditor).TextBoxControl.Style.Add("text-align", "right")

            End If

        End If

    End Sub

 

 

I believe this event is fired when the grid is creating the edit columns.  You hook into this event, and then modify the textboxstyle in order to change the look of the edit control.

 

 

Defined Column Editor

 

You can achieve the same results as in CreateColumnEditor without writing any code if you drop a GridTextBoxColumnEditor on your page (outside of the RadGrid) like so:

 

<telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server">

    <TextBoxStyle Width="50px" />

</telerik:GridTextBoxColumnEditor>

 

And then in your column you specify the ID of the editor you want to use, like this:

 

<telerik:GridBoundColumn DataField="UserId" DataType="System.Int32" HeaderText="UserId" ColumnEditorID="GridTextBoxColumnEditor1"

    SortExpression="UserId" UniqueName="UserId">

</telerik:GridBoundColumn>

 

 

 

 

Categories: Programming | .Net | ASP.Net
Thursday, March 11, 2010 3:08:27 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

SSRS report fails with vertical text#

We ran into an interesting problem today.

A matrix report in SSRS (sqlserver reporting services) 2008 would work just fine when previewing it in VS, and would work fine when viewed directly on the reporting server.  But, if you view it through a asp.net reportviewer control, it would just show the header, a big blank space, and then the footer.

This only happens if you have Vertical text for the row headers.  Remove that and everything is OK.

I began editing the generated CSS/HTML and found that the cells had a number of styles applied, but specifically the one that seemed to break everything was:

WIDTH:100%;

Remove that and the page rendered as expected.

We tried changing a number of parameters to get it to remove the width style but no luck.

We have something that generates images with GDI to do it now, but it's not ideal.

Categories: Programming | .Net | ASP.Net | Reporting
Friday, September 25, 2009 1:49:54 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

ASP.NET Apps Recycling Because of FCN Issues#

I have written before about some of the problems that a frequently recycling asp.net application can cause, espically if you are using session for anything.

ASP.NET Process Recycling Too Often

But I ran into a situation where the recycle was caused by the application itself for a client of mine.  I had bought and customized a asp.net application that allows my client to give THEIR clients access to a section of their site where they can upload/download/manage files very nicely.  But after moving to a new hosting environment, users kept losing their login sessions very quickly.

After some research, I found out that session was being used to track if the user was logged in, and session was being lost very quickly because the application was recycling.

I used the following code to help diagnose the cause for the application restarting:

(this goes in Application_End)

Dim runtime As HttpRuntime = GetType(System.Web.HttpRuntime).InvokeMember("_theRuntime", _
    BindingFlags.NonPublic Or _
     BindingFlags.Static Or _
    BindingFlags.GetField, _
    Nothing, Nothing, Nothing)

If runtime Is Nothing Then
    logger.Error("The application is closing at " & Now.ToShortDateString & " " & Now.ToLongTimeString)
    Return
End If

Dim shutDownMessage As String = runtime.GetType().InvokeMember("_shutDownMessage", BindingFlags.NonPublic Or BindingFlags.Instance Or BindingFlags.GetField, Nothing, runtime, Nothing)
'If shutDownMessage = "HostingEnvironment caused shutdown" Then
'    '*** this is normal, you can include this commented out section or not
'    Return
'End If
Dim shutDownStack As String = runtime.GetType().InvokeMember("_shutDownStack", BindingFlags.NonPublic Or BindingFlags.Instance Or BindingFlags.GetField, Nothing, runtime, Nothing)
'*** email this error
logger.Error(String.Format("The application is closing at " & Now.ToShortDateString & " " & Now.ToLongTimeString & " " & vbCrLf & vbCrLf & "_shutDownMessage={0}" & vbCrLf & vbCrLf & "_shutDownStack={1}", shutDownMessage, shutDownStack))


Dim log As New EventLog
log.Source = ".NET Runtime"
log.WriteEntry(String.Format(vbCrLf & vbCrLf & "_shutDownMessage={0}" & vbCrLf & vbCrLf & "_shutDownStack={1}", shutDownMessage, shutDownStack), EventLogEntryType.Error)

The cause was:

Directory rename change notification for 'APP PATH HERE.
Clients dir change or directory rename
HostingEnvironment caused shutdown

Because this app was now hosted with a 3rd party, I didn't have control over the environment to go see if there was an AV scanner or backup manager running that was touching the files.

However, I because I was able to reproduce the error in my dev environment, I was confident I could rule out those causes.

I eventually found that the problem was 2 fold:

1) The application allows the user to upload files/create folders that reside in subfolders of the application.  The app could think these changes require a recycle.

2) The application creates a temp folder for the user for each session under the root as well.  Changing folder structure can cause a recycle.

So what can be done?

Well, I adapted some code from a few places to turn off the FCN (File change notifications) for sub directories of the website.  This isn't easy to do if you don't have something to go off of, becaues you basically have to hijack your way into private methods on classes in the .net framework, using reflection to call methods that you shouldn't be accessing, in order to turn off specific behavior.

Here are the methods I created to help me do this.  I also have some log4net code in here, so you'll have to pull that out if you want to use this.

Private Sub TurnOffDirectoryMonitoring()
    Try
        Dim p As System.Reflection.PropertyInfo = GetType(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.Static)
        Dim o As Object = p.GetValue(Nothing, Nothing)

        Dim f As FieldInfo = o.GetType.GetField("_dirMonSubdirs", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.IgnoreCase)

        Dim monitor As Object = f.GetValue(o)

        Dim asdf As System.Reflection.MethodInfo() = monitor.GetType.GetMethods()

        Dim propIsMonitoring As System.Reflection.MethodInfo = monitor.GetType.GetMethod("IsMonitoring", System.Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic)
        Dim bIsMonitoring As Boolean = propIsMonitoring.Invoke(monitor, Nothing)
        Dim logger As log4net.ILog = log4net.LogManager.GetLogger("File")
        logger.Info("Directory monitoring IsMonitoring was " & bIsMonitoring)


        Dim m As System.Reflection.MethodInfo = monitor.GetType.GetMethod("StopMonitoring", System.Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic)

        Dim objArray() As Object = {}
        m.Invoke(monitor, objArray)

        logger.Info("Directory monitoring IsMonitoring after change is " & bIsMonitoring)

    Catch ex As Exception
        Dim logger As log4net.ILog = log4net.LogManager.GetLogger("File")
        logger.Error(ex) 
    End Try
End Sub

Private Sub CheckDirectoryMonitoring()
    Try
        Dim p As System.Reflection.PropertyInfo = GetType(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.Static)
        Dim o As Object = p.GetValue(Nothing, Nothing)

        Dim f As FieldInfo = o.GetType.GetField("_dirMonSubdirs", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.IgnoreCase)

        Dim monitor As Object = f.GetValue(o)

        Dim asdf As System.Reflection.MethodInfo() = monitor.GetType.GetMethods()

        Dim propIsMonitoring As System.Reflection.MethodInfo = monitor.GetType.GetMethod("IsMonitoring", System.Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic)
        Dim bIsMonitoring As Boolean = propIsMonitoring.Invoke(monitor, Nothing)
        Dim logger As log4net.ILog = log4net.LogManager.GetLogger("File")
        logger.Info("In CheckDirectoryMonitoring, Directory monitoring IsMonitoring is " & bIsMonitoring)
    Catch ex As Exception
        Dim logger As log4net.ILog = log4net.LogManager.GetLogger("File")
        logger.Error(ex)
    End Try
End Sub

Private Sub CheckFCNMode()
    Try
        Dim p As System.Reflection.PropertyInfo = GetType(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", BindingFlags.NonPublic Or BindingFlags.Public Or BindingFlags.Static)
        Dim o As Object = p.GetValue(Nothing, Nothing)

        Dim f As FieldInfo = o.GetType.GetField("_FCNMode", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.IgnoreCase)

        Dim iFCNMode As Integer = f.GetValue(o) 
        Dim logger As log4net.ILog = log4net.LogManager.GetLogger("File")
        logger.Info("In CheckFCNMode, FCNMode is " & iFCNMode)
    Catch ex As Exception
        Dim logger As log4net.ILog = log4net.LogManager.GetLogger("File")
        logger.Error(ex)
    End Try
End Sub

These methods are not refactored or "best practice" at all, there is a lot of copy/paste code in here, but you'll get the idea of what I'm doing.

You can call these methods from the beginning on Application_Start. 

1 thing to note.  I found that my code that checks to make sure that logging was turned off, doesn't seem to report the right value the first time I check it.  But by the time the first session starts, it has indeed stopped monitoring.

Just try calling these methods from a few places after application_start and you can see what happens.

 

Categories: Programming | .Net | ASP.Net
Thursday, April 02, 2009 12:27:04 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Using Asyncronous Tasks In ASP.NET#

ASP.NET has a limited number of threads that it uses to service incoming requests.  Thes threads from the its thread pool, and when its collection of threads are busy, requests have to queue up waiting for an open thread.

But, what happens when you have threads that are blocking waiting for another process to complete?  This could we a database call, or a webservice call, or an IO operation etc.

Well, what happens is that the thread, while doing no real work, is unavailable to service requests.

So, if your database is crunching on some long queries, other simple web requests may be sitting in the queue unable to be handled, even though the webserver CPU is idle.

One solution to this is to use Async pages/methods in ASP.NET 2 or greater.

Async operations allow the thread to be returned back to the thread pool instead of blocking, while some process is executed.

 

There is more than 1 way to do async operations like this from asp.net pages. 

One is to use RegisterAsyncTask and the other to user AddOnPreRenderCompleteAsync as well as declare the page as Async="true".

I won't go into all the details, but AddOnPreRenderCompleteAsync is probably simpler, but you can't define a timeout, you can't call it multiple times in parallel, and in the EndAsyncOperation event handler you can't access things like the httpcontext object.

Here are 2 examples of pages that are asynchronously serving up a PDF document (which is itself served from a page DownloadPDF.aspx, which has a 5 second thread sleep in it to simulate the processing of the report on another server.

Using AddOnPreRenderCompleteAsync:

Imports System.Net
Imports System.IO

Partial Class AsyncServer
    Inherits System.Web.UI.Page

    Dim _request As WebRequest

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        AddOnPreRenderCompleteAsync(New BeginEventHandler(AddressOf BeginAsyncOperation), _
                                    New EndEventHandler(AddressOf EndAsyncOperation))
    End Sub

    Function BeginAsyncOperation(ByVal sender As Object, ByVal e As EventArgs, ByVal cb As AsyncCallback, ByVal state As Object) As IAsyncResult
        _request = WebRequest.Create(HttpContext.Current.Request.Url.Scheme & _
                                     "://" & HttpContext.Current.Request.Url.Authority & _
                                     Page.ResolveUrl("DownloadPDF.aspx"))
        Return _request.BeginGetResponse(cb, state)
    End Function

    Sub EndAsyncOperation(ByVal ar As IAsyncResult)
        Dim reportResponse As WebResponse = _request.EndGetResponse(ar)
        Dim reader As New BinaryReader(reportResponse.GetResponseStream())

        Dim buffer(reportResponse.ContentLength) As Byte
        buffer = reader.ReadBytes(buffer.Length)
        
        Response.Clear()
        Response.ClearHeaders()
        Response.ClearContent()
        Response.ContentType = "Application/pdf"
        Response.BinaryWrite(buffer)
    End Sub

End Class

 

But I prefer to use RegisterAsyncTask.  Now, keep in mind that many operations will already support async versions (webrequests, webservice calls, databases calls, file IO etc), but if there isn't already built in support for an async call, you can make your own method work in this framework with an async delegate.  Check out the commented code below for how you could do this, but because webrequests already support making the call in an asynchronous fashion, I don't need to.

Imports System.Net
Imports System.IO

Partial Class RegisterAsyncTaskServer
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Page.AsyncTimeout = New System.TimeSpan(0, 0, 8)
        Dim task As New PageAsyncTask(New BeginEventHandler(AddressOf BeginGetAsyncData), _
                                      New EndEventHandler(AddressOf EndGetAsyncData), _
                                      New EndEventHandler(AddressOf TimeoutGetAsyncData), "task1", True)

        RegisterAsyncTask(task)
    End Sub

    '*************** This is one way to do this if not using an async download method by creating an async delegate
    'Dim taskDelegate As AsyncTaskDelegate
    '' Create delegate.
    'Delegate Sub AsyncTaskDelegate()
    'Private Function BeginGetAsyncData(ByVal src As Object, ByVal args As EventArgs, ByVal cb As AsyncCallback, ByVal state As Object) As IAsyncResult
    '    Dim extraData As New Object
    '    taskDelegate = New AsyncTaskDelegate(AddressOf DownloadReport)
    '    Dim result As IAsyncResult = taskDelegate.BeginInvoke(cb, extraData)
    '    Return result
    'End Function
    'Private Sub DownloadReport()
    'End Sub

    Private reportRequest As WebRequest

    Private Function BeginGetAsyncData(ByVal src As Object, ByVal args As EventArgs, ByVal cb As AsyncCallback, ByVal state As Object) As IAsyncResult
        reportRequest = WebRequest.Create(HttpContext.Current.Request.Url.Scheme & "://" & _
                                          HttpContext.Current.Request.Url.Authority & _
                                          Page.ResolveUrl("DownloadPDF.aspx"))
        Return reportRequest.BeginGetResponse(cb, state)
    End Function


    Private Sub TimeoutGetAsyncData(ByVal ar As IAsyncResult)
        Response.Write("TIMEOUT")
    End Sub

    Private Sub EndGetAsyncData(ByVal ar As IAsyncResult)
        Dim reportResponse As WebResponse = reportRequest.EndGetResponse(ar)
        Dim reader As New BinaryReader(reportResponse.GetResponseStream())

        Dim buffer(reportResponse.ContentLength - 1) As Byte
        buffer = reader.ReadBytes(buffer.Length)

        Response.Clear()
        Response.ClearHeaders()
        Response.ClearContent()
        Response.ContentType = "Application/pdf"
        Response.BinaryWrite(buffer)
        Response.Flush()
    End Sub

End Class

Nice!

Categories: Programming | .Net | .Net Framework | ASP.Net
Friday, March 13, 2009 10:46:43 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Regenerating the designer.vb and designer.cs files#

Chances are you have had this happen to you.

You start getting compile errors on your asp.net controls in your code behind pages.  But the controls exist on the page??  Whats the deal?

Well, in VS2003 the designer would create the class level controls in your code behind.  It would created a special region where it would put all it's autogenerated code.

2005 brought the new "Web Site Project" which used a "CodeFile" instead of "CodeBehind" attribute on the page tag.  In addition, the codefile/codebehind became a Partial Class.  VS would then put all the generated code in a seperate file so it didn't cramp up your code behind.

In Web Application projects, the autogen code is stored in .designer.vb files:

But everynow and then, things get out of sync, or the designer files get totally lost.

Here is how you can regenerate them:

First, make sure your class names, and page attributes are right.  The Page tag should have a Codebeind attribute pointing to the aspx.vb file and an Inherits attribute that contains the fully qualified class name in the codebehind.  (This instructions are for Web App Projects, not Web Site Projects, which use Codefile instead of Codebehind).

Second, create a designer file if one doesn't exist.  Click the "Show all files" icon in the Solution Explorer to see if you have designer files.  If not, add a class file with the right name page_name.aspx.designer.vb.  VS will automatically put it "under" the aspx page.

Make sure all namespaces are right.  Check your code beind, your designer file, and your page codebehind attribute.

Open your page in a designer and rename one of your controls.  Save everything and close the code and designer windows.  Open the designer back up and rename the control back.  Now look at your designer file, it should have a punch of controls in it, and now VS shouldn't complain about compile errors in your code behind.

 

Categories: Programming | .Net | ASP.Net | VS.Net
Monday, February 23, 2009 4:07:35 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Webservices: The request failed with HTTP status 400: Bad Request#

We have a webservice that is called from an application under heavy use.

From time to time we are getting errors coming back from the webservice:

The request failed with HTTP status 400: Bad Request

The stack trace is not very helpful:

at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

So basically the webservice is just throwing back a 400 error to the webservice request.

I haven't seen anyone online who has this type of issue.  I have seen several where they ALWAYS get this error, but none where it works most of the time and fails sometimes.

I am considering that it could be something in the network, like a proxy server or AV sniffer, but not sure.

 

Categories: Programming | .Net | .Net Framework | ASP.Net | WebServices
Tuesday, November 18, 2008 5:21:48 PM (Central Standard Time, UTC-06:00) #    Comments [1]  | 

 

Putting code in server controls attributes#

You can't do something like this:

<asp:Label id="lbl1" runat="server" Text=<%= CurrentUserName %> />

That is because it won't let you assign a server tag result to the attribute of a server control.

Thankfully, there is a solution:

http://weblogs.asp.net/infinitiesloop/archive/2006/08/09/The-CodeExpressionBuilder.aspx

 

Categories: Programming | .Net | ASP.Net
Wednesday, October 08, 2008 3:25:31 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Careful With Those Cookies#

When doing testing, you might find yourself wanting to delete cookies for some URLs on your development machine.

Now, you need to be careful about how you delete these cookies, because Microsoft decided to pull a little trick on you.  They created a folder:

C:\Documents and Settings\[user]\Cookies

This folder seems to contain all your cookies!  But, actually it doesn't.  Deleting these cookies really doesn't clear out the cookies you think you are deleting because the REAL cookies are stored in:

C:\Documents and Settings\[user]\Local Settings\Temporary Internet Files

This folder contains cookies and other temporary internet files, but of the most importance here is that THIS is where you need to clear your cookies from.

I came across another thing on a recent project is that you can't test for the existance of an outbound cookie.

If Response.Cookies.Item("ASDFA") Is Nothing Then
     Response.Write("This Will Never Execute")
End If

Why is this?  It is because with the Response.Cookies collection (but not on the Request's cookies collection) when you request an item from the collection that doesn't exist it CREATES it, with a value of an empty string.

 

Categories: Programming | .Net | ASP.Net
Thursday, July 31, 2008 5:42:33 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Generating Resx Files For Globalization and Localization#

Using resource files (resx files) for globalization is a standard technicque.  ASP.NET allows you to create 1 resx file per page to help you manage your content.

But when it is time to convert those files into the correctly named localized version to send to the translator, you might find yourself doing a lot of copying and renaming.

So I wrote a little script that does this for you:

Imports System.IO
Module Module1

    Sub Main()
        Dim languages() As String = {"es", "pl", "de", "fr"}
        For Each filepath As String In Directory.GetFiles("C:\translationTest")
            If filepath.Contains("x.resx") Then
                For i As Integer = 0 To languages.Length - 1
                    File.Copy(filepath, filepath.Replace(".resx", "." & languages(i) & ".resx"))
                Next
            End If
        Next
    End Sub

End Module

This will generate all the files for you, and then all you need to do is send the off and wait for the translator to do the REAL work :).

Categories: Programming | .Net | .Net Framework | ASP.Net
Tuesday, July 22, 2008 3:13:50 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Model View Presenter Guidance From MS Patterns and Practices#

Microsoft's Patterns and Practices group has released some guidance for creating MVP web applications.

http://www.pnpguidance.net/Tag/MVPBundle.aspx

I haven't checked this out, so I can't verify if they are worth looking into you, but I will be reading them in the near future.

Categories: Programming | .Net | ASP.Net
Tuesday, June 24, 2008 5:55:57 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

FancyUpload Component#

I recently wrote about how the Flickr Uploadr tool sucks, but the other part of that article was how the web upload tools for Flickr is very nice!

FancyUpload is a set of code using Flash/Javascript to perform out of band file uploads.

This is basically how Flickr allows you to queue files for upload in their web client, and it is very useful in this sense because it would be extremely painful to be forced to post every single image individually.

For me, I am more interested in the ability to post very large files without leaving the brower in a fashion that seems to make it look like it is "stuck" when really it is just uploading a giant file.

 

Categories: Misc | Programming | .Net | ASP.Net | Flash
Tuesday, June 24, 2008 10:26:51 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Globalization and Localization in ASP.NET#

This is a good article from Microsoft on globalization and localization of asp.net applications.

The article describes how to automate the process of moving static content from pages (inside labels) into resource files and setup the proper binding between the content controls and the resource files.

This article has some interesting and useful information as well about some other topics such as global vs local, implicit globalization settings, dealing with scripts etc.

Categories: Programming | .Net | ASP.Net
Monday, June 23, 2008 5:52:24 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

e.Item.Dataitem is nothing?#

So you have some code running in your itemdatabound event handler and you are trying to do someting with e.item.dataitem but it keeps bombing out with errors because e.item.dataitem is nothing.

So, why is e.item.dataitem is nothing??

Answer: Because you are probably using a header or footer in your binding object.  The header/footer will cause the itemdatabound event to fire, but there is no dataitem for them.

Check if the current row is the header or footer, and then you will have no issues with using e.item.dataitem.

Categories: Programming | .Net | ASP.Net
Thursday, June 19, 2008 4:22:37 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VS.NET Extensions for Sharepoint#

My experience with developing for Sharepoint was very painful.  The jist of it was, unless you are truly going to hook into a lot of the core functionality of sharepoint (document collaboration and workflow) it will be MUCH harder to build an app to run in sharepoint than it would be to build a standalone application.

But MS has released some new extensions that will hopefully ease the pain a little bit:

Announcing: Visual Studio extensions for SharePoint – Developer User Guide

I don't know if I will ever have enough time to implement anything in sharepoint, but these will be nice to have.

Categories: Programming | .Net | ASP.Net
Thursday, June 12, 2008 12:50:21 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Highslide#

We have been working with a pretty cool little javascript toolkit called Highslide.

http://vikjavev.no/highslide/

It gives you some nice lightbox type effects but I like it more because of some of the options to load in iframes and stuff.

Someone wrote some asp.net wrappers as well to make it easier to add to your pages:

http://encosia.com/

 

Categories: Programming | .Net | ASP.Net | HTML | Javascript
Thursday, June 05, 2008 4:21:01 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

BoundFields, DataFormatString, and HtmlEncode#

Ran into this again today.

<asp:BoundField
  DataField="FollowUpDate"   
  DataFormatString="{0:MMM-dd-yy}"   
  HtmlEncode="false"  
  HeaderText="Follow Up Date" />

If you are doing a boundfield in an asp.net gridview, and you play on using the DataFormatString, you have to set HtmlEncode to false.

Kinda stupid, but that's life.

Categories: Programming | .Net | ASP.Net
Wednesday, January 30, 2008 10:33:13 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Using a STYLE block on a page with a Master Page#

I have been asked this a few times, so I decided to write up a little article on it.

The problem is that when you are using master pages in asp.net, the <HEAD> is usually inside the master page template.  So if you are on a page that needs a 1 off change or addition to the style of the rest of the site, you are unable to create a <STYLE> element in your content page.

Well, you CAN create one, but then VS.Net won't show you the designer for your page b/c it keeps asking you to clean up the HTML problems on your page.

The solution I have used is to create a 2nd content place holder in the master page head.  But, I might as well not duplicate effort here, as Rick Strahl has already written the article I am about to write (and apparently, even someone else beat him to the punch).

http://www.west-wind.com/WebLog/posts/5706.aspx

This works very well for this type of situation. 

 

Categories: Programming | .Net | ASP.Net | HTML
Monday, January 14, 2008 7:21:52 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

What could cause this casting error?#

Error:

Unable to cast object of type 'System.Collections.Generic.List`1[EditQuoteController+UnsavedQuoteItemInfo]' to type 'System.Collections.Generic.List`1[EditQuoteController+UnsavedQuoteItemInfo]'.

Yes, you read that right.  Unable to cast object of type X to type X.

I have seen this type of error once before and it was when there were multiple assemblies referencing different version of a common assembly, so even though their names were the same, their versions were different.

But in this instance there is nothing like this that could be having an impact.  All of the classes of consequence are in the same assembly.

Also, I don't get exception very often, only every now and then.

UPDATE:

I think maybe this is happening between builds on my development machine b/c I am storing some data in the session.  So the version in session was from the last build?  Doesn't sound like a great explanation, but it's the best I have at this point.

UPDATE 2:

I am pretty sure that what I wrote in the last update is what is actually happening. 

I used this code:

Try
    list = CType(view.Session.Item(Me.UnsavedKey), List(Of UnsavedQuoteItemInfo))
Catch ex As System.InvalidCastException
    Dim sError As String = "Unable to cast from type " & _
        view.Session.Item(Me.UnsavedKey).GetType.AssemblyQualifiedName & _
        " to type " & GetType(List(Of UnsavedQuoteItemInfo)).AssemblyQualifiedName & _
        ".  The session has been cleared."
    view.Session.Item(Me.UnsavedKey) = Nothing
    Throw New System.ApplicationException(sError)
End Try

Which producted the following 2 types:

System.Collections.Generic.List`1[[EditQuoteController+UnsavedQuoteItemInfo, App_Web_bp-bbqew, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=2.0.0.0, Culture=neutral PublicKeyToken=b77a5c561934e089

System.Collections.Generic.List`1[[EditQuoteController+UnsavedQuoteItemInfo, App_Web_ve7ziow-, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. 

I am guessing this is a by product of using the web site project, instead of web application project.  There are some other reasons why we wanted to use web site instead of web app on this project, so you don't have to scold me: we made the right choice.

But it seems that every time I make a change to the project, it creates a new dynamically named assembly.  So even though the classes are really the same, they are globally different as far as asp.net is concerned.

 

Categories: Programming | .Net | .Net Framework | ASP.Net
Monday, January 14, 2008 3:14:02 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Using Redirects The Right Way For SEO#

Rob Howard has a nice article on how to use the 301 redirect (permanent redirect) in order to get search engines to spider the new page, as opposed to just using Response.Redirect, which will send a 302 (temporary redirect) to the client.

Categories: Programming | .Net | ASP.Net
Thursday, January 10, 2008 2:49:33 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

WebAii Website Automated Testing Framework#

I am always on the lookout for better and easier ways to automate testing of my applications.  Mostly, this stems from my teams not being too keen on implementing testing, so the easier I can make it, the easier it will be to convince others to write tests.

So Phil Haack has suggested a free framework called WebAii, and after taking a quick look, it looks promising.

It supports some nice features like mouse/keyboard actions for Ajax testing, and dom actions (find an element and click it, or whatever).  It also supports unit testing your javascript functions by having your test call the functions.  It also integrates with Nunit.  Nice!

Hopefully I can find some free time (HAHAHHAAH) when I can test this out more in a project.

 

Categories: Programming | .Net | ASP.Net | HTML | Testing
Thursday, January 10, 2008 1:55:44 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Free Flyout and Alternating Panel Controls#

These are some nice looking, cross browser compliant, ASP.NET based, free controls from Obout.com

Flyout can perform stuff like this:

But almost more interesting is how it can be used in conjunction with traditional controls.  For example, you can wire up a nice looking "Alt Text" effect for images and labels, and you can provide some nice explanation in the flyout for how to properly fill in a control.  The example they give on their site shows a textbox for "Routing Number" and when you click on the textbox it shows this in the flyout:

 

 

The alternating content control which is called "Show" (Show examples) can rotate through some content like so:

These are both free controls.  Very nice!

 

Categories: Programming | .Net | ASP.Net
Friday, November 30, 2007 2:18:56 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

ASP.NET Application Not Reading The Web.Config File#

I recently ran into an interesting problem... my webservice application seemed unable to read info from the web.config file.

I tried adding some invalid < marks to the config file and the app still ran w/o any error (but still wouldn't read the web.config appSettings or connectionString sections).

So I created another IIS application and it worked as expected.

So I deleted the troubled IIS App and recreated it.  Still broken!

The solution was to clear out the ASP.NET Temporarly Files folder in c:\windows\...\...

Once that was gone, and I restarted IIS, everything went back to normal.

 

Categories: Programming | .Net | ASP.Net
Friday, November 16, 2007 10:20:04 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Solution for "Thread was being aborted" exception when you call Response.End (or .Redirect)#

You've probably seen this one.

Whenever you do one of the following:

Response.End()
Response.Redirect("page.aspx")
Server.Transfer("page.aspx")

You end up with a ThreadAbortException, "Thread was being aborted".

I had previously dealt with this by swallowing the ThreadAbortException, which of course isn't a great method, but it worked.

Well today I came across a better way for all of these.

Replace This With This
Response.End HttpContext.Current.ApplicationInstance.CompleteRequest
Response.Redirect("page.aspx") Response.Redirect("page.aspx",false)
Server.Transfer("page.aspx") Server.Execute("page.aspx")
Categories: Programming | .Net | ASP.Net
Tuesday, November 13, 2007 1:06:39 PM (Central Standard Time, UTC-06:00) #    Comments [1]  | 

 

ScottGu Demos Upcoming MVC Framework for ASP.NET#

In a recent gathering of the ALT.NET group, ScottGu gave a demo of the upcoming MVC framework for asp.net.

The article (and video) can be found here.

Lots of people in the ALT community have been working with asp.net and MVC by using one of the OS frameworks out there like Monorail, but I am glad to see that MS is not sitting around waiting on this issue.

Hopefully this will make testing even easier. 

Categories: Programming | .Net | ASP.Net
Tuesday, October 30, 2007 9:44:25 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

404s on ASP.NET AJAX script files in the System.Web.Extensions folder#

Recently I ran into a problem where browsing to a newly installed web app produced a bunch of javascript errors.  Stuff like: "'Type' is not defined" and "'Sys' is not defined".

After debugging it for a while, I found the problem to be that URLScan had been installed on the server (Windows 2000 Server), which was preventing any requests with dots in the folder name.

URL Scan is a tool that MS suggested everyone install a while back that acts to filter out many malicious attacks.

So, with the default settings any request for a file inside the scripts\System.Web.Extensions folder would be denied as a 404 b/c of URL Scan.

To fix this, you need to edit the UrlScan.ini file, located in %WINDIR%\System32\Inetsrv\URLscan.  Near the top of the file, change AllowDotInPath from 0 to 1.

The run iisreset to restart IIS and you should be ok!

More info on URLScan is available here:

http://support.microsoft.com/kb/326444

 

Categories: Programming | .Net | ASP.Net | AJAX | IIS
Tuesday, September 11, 2007 2:17:20 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Subsonic MVC Templates. Not what I was expecting.#

When I saw a new item in my RSS feed from Rob Conery about MV* I was immediately interested to read it, because I have been working on trying to create my web app pages using MVP, but am unable to find any examples beyond the most basic.

I would love to see how other people manage the interactions between the Controller and the View, to see how it compares to how I am doing it. 

My view interfaces tend to be kinda large.  For example, if I have a button that I hide and show depending on business rules, I will create a MyButtonVisibility property on the interface can set the properties from the controller.

I would be interested to see how others deal with things like the hiding / showing of items.  I could see wrapping more of that kind of functionality in the view, and giving the view some more logic but I think you would then start to lose some of the testability.

Anyway, the articl on Rob's blog was really to talk about creating an MVC style architecture for subsonic itself, not the pages that use it.  However, Rob seemed to suggest that the new changes would aid you in using MV* in your pages by forcing you into good habits.

But I really don't understand how that would work.  If you have code that does:

MyGridView.DataSource=Product.FetchAll();
MyGridView.DataBind();

And you change it so that you use a Controller (or Manager as I have called it when loading Business Objects or DTOs) to look like this:

Product product = ProductController.Get(newID);
product.ReorderLevel = 100;
ProductController.Save(product,"unit test");

I don't see how this helps you create an MV* architecture in your pages.

Maybe I am just not understanding.

 

Categories: Programming | .Net | ASP.Net | Architecture
Thursday, July 19, 2007 10:06:07 AM (Central Daylight Time, UTC-05:00) #    Comments [2]  | 

 

ASP.NET "How Do I" Videos#

The asp.net site has a section where they are putting up short videos showing how to do things in asp.net as well as VSTS and asp.net AJAX.

You can find the site here, and the RSS feed here.

There are some similar videos started to get produced for TFS here, with an RSS feed here.

 

Categories: Programming | .Net | ASP.Net
Tuesday, June 26, 2007 5:50:51 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Microsoft P&P Software Factories#

I didn't notice that the Microsoft P&P team has released something they call "Software Factories" which are supposed to guide the developer in building different apps using best practices (at least that is what I think they do from the descriptions).

Specifically I am interested in the Web Client Software Factory:

... provides an integrated set of guidance that assists architects and developers in creating composite Web applications and page flow client applications.

These applications have one or more of the following characteristics:

  • They have complex page flows and workflows.
  • They are developed by multiple collaborating development teams.
  • They are composite applications that present information from multiple sources through an integrated user interface.
  • They support XCopy deployment of independently developed modules.
  • They support online business transaction processing Web sites.

 

and the Web Service Software Factory, which as they put it is:

... an integrated collection of tools, patterns, source code and prescriptive guidance. It is designed to help you quickly and consistently construct Web services that adhere to well known architecture and design patterns.

The package covers:

  • Designing ASMX and WCF messages and service interfaces.
  • Applying exception shielding and exception handling.
  • Designing business entities in the domain model.
  • Translating messages to and from business entities.
  • Designing, building, and invoking the data access layer.
  • Validating the conformance of service implementation, configuration, and security using code analysis.
  • Planning for the migration to WCF.
  • Applying security to WCF services.
  • Applying message validation.
  • Categories: Programming | .Net | ASP.Net | WebServices
    Tuesday, June 05, 2007 11:59:00 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Nice NUnitASP writeup.#

    Over at TheServerSide they had a nice writeup of an example of how to use NUnitASP to test the UI of some pages.

    I am not sure how valuable this would be to invest my time in, espically as it seems that there is now way to test repeaters or gridviews (there is a datagridtester however).

    I will have to look some more and see if ther eis a way to do this.

    Categories: Programming | .Net | ASP.Net | Testing
    Sunday, June 03, 2007 3:48:28 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Refactor! for ASP.NET#

    This looks really cool. 

    You can download it here for free.

    Included Refactorings

    Add Validator
    Create Overload
    Encapsulate Field
    Extract ContentPlaceHolder
    Extract ContentPlaceHolder (create master page)
    Extract Method
    Extract Property
    Extract Style (Class)
    Extract Style (id)
    Extract to User Control
    Flatten Conditional
    Inline Temp
    Introduce Constant
    Introduce Local
    Introduce Local (replace all)
    Move Declaration Near Reference
    Move Initialization to Declaration
    Move Style Attributes to CSS
    Move to Code-behind
    Rename
    Reorder Parameters
    Replace Temp with Query
    Reverse Conditional
    Safe Rename
    Simplify Expression
    Split Initialization from Declaration
    Split Temporary Variable
    Surround with Update Panel
     

    UPDATE:  It seems that installing this may have removed some of the features of the old Refactor! that I was frequently using (?).  I used to use the "Surround With-->Region" all the time.  Now that is gone.  I will have to investigate.

    Categories: Programming | .Net | ASP.Net | Tools
    Friday, June 01, 2007 9:57:43 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Asp.net Label vs Literal#

    It looks like I have fallen victim to an asp.net no-no.

    I have always used a label in my forms when I want to have some text that is updated by the code behind.  Turns out that I should probably be using literals.

    Even more, I didn't even realize that the label object allows you to specify a text element that will gain focus when the label is clicked.  Nice.

    Categories: Programming | .Net | ASP.Net
    Monday, May 28, 2007 2:49:53 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Rhino Mocks#

    Rhino Mocks seems to be one of the most preferred mock frameworks out there.

    Phil Haack, CodeBetter and Markitup have article showing how to test events on interfaces (x2) and objects in Rhino Mocks respectively.

    They even have some videos up showing some Rhino Mocks stuff.

    Haack also has a nice example of using MVP and Rhino Mocks to test some asp.net pages.

    Categories: Programming | .Net | ASP.Net | Testing
    Monday, May 28, 2007 2:33:20 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Drill Through Reports using Report Viewer and ASP.NET 2.0#

    Here is an interesting article on codeproject about creating "drill through" reports.

    Categories: Programming | .Net | ASP.Net | Reporting
    Friday, May 11, 2007 1:22:26 PM (Central Daylight Time, UTC-05:00) #    Comments [2]  | 

     

    ASP.NET AJAX Errors#

    I have been getting a few errors when trying to use the asp.net ajax framework.

    The one error message is:

    Error: Sys.ArgumentTypeException: Object of type 'Sys_Application' cannot be converted to type 'Sys._Application'/

    Parameter name: instance

    This is caused by having SmartNavigation turned on for the page. 

    The other error I was getting was this Sys.ArgumentOutOfRangeException.  Value must be an integer.  Parameter name: X.  Actual value was NaN.

    This error is caused by using a "yes" or "no" for "frameborder" for a frame.

    Yes and No are valid entries but the framework is expecting a "1" or a "0".

     

    Categories: Programming | .Net | AJAX | ASP.Net
    Thursday, April 26, 2007 3:16:06 PM (Central Daylight Time, UTC-05:00) #    Comments [1]  | 

     

    ASP.NET Upload Component#

    I think I saw this ABCUpload .Net tool being used by microsoft on one of their internal support sites for uploading large files.

    I don't think it actually gets around the httprequest length and executiontimeout problems, but it does provide you a window showing your progress, which is nice.

    Categories: Programming | .Net | ASP.Net
    Monday, April 23, 2007 4:05:47 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    ASP.NET Process Recycling Too Often#

    I'm not going to write too much about this, but we have been seeing a LOT of recycles of our web application, which makes us lose session for everyone logged it.

    I am just going to archive a few links I have been using to track down this problem.

    ScottGu has some reflection code to get the reason the process is shutting down that I converted to vb.net

    Scott Gu's Article

    And here are some places discussing the issue:

    asp.net thread

    Todd Carter's Blog Article

    Scott Forsyth's Blog Article

    Categories: Programming | .Net | ASP.Net
    Wednesday, April 11, 2007 10:34:58 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    ASP.NET Design Patterns#
    Categories: Programming | .Net | .Net Framework | ASP.Net
    Wednesday, April 11, 2007 10:17:54 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    ASP.NET RegularExpressionValidator with Phone Extension Numbers#

    The built in options for validating an email address didn't include any way to validate phone numbers that include extension numbers.

    Here is a regular expression that does this:

    ((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}( x\d{0,})?

     

    Categories: Programming | .Net | ASP.Net
    Thursday, March 22, 2007 5:42:21 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    AutoSuggest Lookup Control... getting closer#

    I have been waiting to see a nice autolookup control that has more features that the current ASP.NET AJAX control offers. 

    This control is pretty close.  I would rather not use the Anthem.net library if possible, but this control looks good.

    Categories: AJAX | ASP.Net
    Monday, March 19, 2007 12:20:03 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Upgrading to ASP.NET AJAX, xhtmlConformance, and JavaScript Errors#

    I recently migrated one of the web applications I work on frequently to make use of the newly released ASP.NET AJAX toolkit.

    In order to make this work, a bunch of changes were needed in the web.config.  So many in fact that I decided to merge my web.config file into theirs, rather than vice versa.

    After all was done and working, we started getting a few javascript errors in stuff unrelated to any ajax controls.

    After some investigation I relized that the naming convention for controls had changed.

    Controls that used to be named ASDF:ZXCV were now named ASDF_ZXCV.

    So in some instances we had javascript looking for elements where the element name was hard coded as "ASDF:ZXCV".  Of course the correct way to get the element name is to use the ClientId property of the control, but that was not used 100% of the time on our site. 

    The problem is that when I upgraded the application from .Net 1.1 to a .Net 2.0 web application project, the upgrade tool included an item in the web.config file that was intended to ease the transition.

    <xhtmlConformance mode="Legacy"/>

    In ASP.NET 2.0, by default all rendered content is well formed XHTML.  This was different from ASP.NET 1.1.  By setting the xhtmlConformance mode to Legacy, it would not force the output to be XHTML compliant.

    Another effect that this has, is the naming of controls.  When Legacy is turned on, control hierarchies are separated by a colon ":".  In standard mode, they are separated by a dollar sign "$" in the name property, and an underscore "_" in the ID property.

    This can be seen if you use reflector on the control class, you can see this:

    internal char IdSeparatorFromConfig
    {
        get
        {
            if (!this.EnableLegacyRendering)
            {
                return '$';
            }
            return ':';
        }
    }

    In 99% of the places where we reference asp.net generated code, we relied on the ClientId property, so we had no problems.  But in that 1% of places where we took the shortcut of hard coding in the element, we got JS errors.

     

    Categories: AJAX | ASP.Net | Javascript
    Monday, March 19, 2007 9:02:21 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Gridview, DateFormatString, and HtmlEncoding#

    Here is the original source of this tip.

    "for some bizarre reason, you have to set HtmlEncode=false on a bound column in a gridview, to get the DataFormatString to work. "

    Categories: Programming | .Net | .Net Framework | ASP.Net
    Tuesday, February 20, 2007 11:59:55 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    .Net Search Engine#

    Lucene.Net is another document index search engine.

    You can point it at some files, office, pdf, rtf, html, and it will index them and provide a nice google-like results page.

    http://dotlucene.net/

    Categories: Programming | .Net | ASP.Net
    Thursday, November 23, 2006 9:21:13 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Default Buttons in ASP.NET 2.0#

    ASP.NET has this thing where pressing Enter on a page will cause it to be submitted, but no submit action is taken, mostly because you can have multiple buttons on a page, and it isn't sure which button it should consider clicked when you press enter.

    The solution to this was the "__EVENTTYPE" field.  Click here for more info on __EVENTTYPE.

    Thankfully ASP.NET 2.0 has introduced some new features to help remove this complexity.

    Scott Gu blogs about the new form defaultButton property, as well as the new SetFocusOnError property of the validators here:

    http://weblogs.asp.net/scottgu/archive/2005/08/04/421647.aspx

     

    Categories: Programming | .Net | ASP.Net
    Saturday, September 30, 2006 3:55:52 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Solution to dasBlog "Remember My Login" Not Working#

    A while ago, maybe 3 months, my blog stopped remembering my login.  When I login I can click to have it remember my login, and thus when I return to the site I don't have to login every time.

    Well I finally arrived at the problem. 

    In IIS settings for the website, under the ASP.NET tab, if you click the "Edit Configuration" button, and then the authentication tab, you have the option to set the expiration length for the cookie, which was set to 1 hour.

    I changed it to a larger value, restarted the IIS processes, and it appears to be working great now!

    Categories: Blogging | Programming | ASP.Net | dasBlog | IIS
    Friday, September 29, 2006 5:00:30 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    SmartNavigation with Metabuilders Combobox#

    I ran into a little problem trying to integrate Metabuilders combobox into an asp.net web app I am creating.

    The problem was that the onload event handler was not properly firing when smartNav was turned on.

    The "InitScript" was as follows:

    if ( typeof( window.addEventListener ) != "undefined" ) {
        window.addEventListener("load", ComboBox_Init, false);
        alert('case 1');
    } else if ( typeof( window.attachEvent ) != "undefined" ) {
        window.attachEvent("onload", ComboBox_Init);
    } else {
        ComboBox_Init();

    }

    Well when you are using smartNav, the window.onload event is only fired the first time you reach the page.  So I used this bit of C# in the control to get it to work.

    String initScript = resources.GetString("InitScript");
    if (this.Page.SmartNavigation)
    {
    this.Page.RegisterStartupScript("MetaBuilders.WebControls.ComboBox Init with Smartnav", "<script>ComboBox_Init();</script>");
    }
    else
    {
    this.Page.RegisterStartupScript("MetaBuilders.WebControls.ComboBox Init", initScript);
    }

     

    Categories: Programming | .Net | ASP.Net | C# | Javascript
    Monday, September 25, 2006 8:06:55 PM (Central Daylight Time, UTC-05:00) #    Comments [1]  | 

     

    Extending the Atlast AutoComplete Extender#

    I have been looking at the new "Atlas" controls, which MS has brilliantly (sarcasm) decided to rename "ASP.NET AJAX".

    The one control I have been most interested in is the autocomplete extender.

    I want to use something like this, not to help populate a textox, but instead to allow the user to type a few characters in to narrow down the list of options, rather than showing them a dropdown of 10,000 items.

    In otherwords, when they are done with the control, I don't want the text in the textbox, I want the database ID value behind it, and i also don't want to let them type in just anything they want, but rather limit their options to what is in the autocomplete options.

    I found another blog post where someone is extending the autocomplete behavior:

    http://aspadvice.com/blogs/garbin/archive/2006/01/02/14518.aspx

     

    Categories: Programming | .Net | ASP.Net
    Monday, September 18, 2006 1:39:31 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Debug = true in web.config files#
    Categories: Programming | .Net | ASP.Net
    Thursday, September 14, 2006 2:22:27 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Data Driven Checkbox (Horizontal) Lists#

    This control is pretty cool.  It makes it pretty easy to databind data into a list of checkboxes.

    http://developer.coreweb.com/articles/Default6.aspx

    Categories: Programming | .Net | ASP.Net | DataBinding
    Wednesday, September 06, 2006 5:54:56 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Rocky Lhotka and Csla.Net/Asp.Net on DnrTV#

    Rochy Lhotka appeared again on DNR-TV for 2 more segments focusing on CSLA in ASP.Net and WebServices:

    http://www.dnrtv.com/default.aspx?showID=32

    http://www.dnrtv.com/default.aspx?showID=33

    Having successfully completed a CSLA.Net project for Wilson Sporting Goods I am interested to see what is different in the web side vs the winform side.

    Categories: Programming | .Net | ASP.Net | DataBinding
    Wednesday, September 06, 2006 4:39:48 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    PostBackUrl And SmartNavigation Bug?#
    I have a page with SmartNav, that contains a linkbutton with a
    PostBackUrl.

    I have found that the page that is the target of the PostBackUrl will
    have it's postback property fired 2 times, and unfortunately, the 2nd
    time it is fired the "PreviousPage" is set to Nothing.

    I have posted a few places to see if someone from MS can confirm this is a bug, but  I am betting they are going to tell me to not use smartnav.

    Categories: Programming | .Net | ASP.Net
    Thursday, August 31, 2006 10:30:38 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Using Postbacks in ASP.NET From showModalDialog pages.#

    If you have an ASP.NET page (.aspx) opened with the JavaScript showModalDialog() function and inside that page there is a form doing PostBack, when the PostBack is being done the page loads in another (popup) window. The easiest way to prevent this is to add the following tag inside the <HEAD></HEAD> tags of the ASP.NET page:

    <base target="_self">

    From: http://www.geekpedia.com/Question23_Using-showModalDialog()-with-an-ASP.NET-page-that-does-PostBack-opens-another-window.html

    Categories: Programming | .Net | ASP.Net
    Thursday, August 24, 2006 2:52:59 PM (Central Daylight Time, UTC-05:00) #    Comments [1]  | 

     

    Databinding "Bind()" in ASP.NET#

    If you used the developemt tools to create a datagrid in ASP.NET 2.0, it will show something like:

    NavigateUrl='<%# Bind("EmployeeId") %>'

    But what if you wanted to do something more complicated that just ge the EmployeeId into the field, like for example if you wanted to run a JS function.  Then you have to do away with Bind and use the more verbose DataBinder method like this: 

    NavigateUrl='<%# "javascript:UseThisJobIndex(" & DataBinder.Eval(Container.DataItem,"JobIndex") & ")" %>'

    That's all there is to it.

     

    Categories: Programming | .Net | ASP.Net | DataBinding
    Thursday, August 24, 2006 1:16:56 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Here Is A Article Talking About The Ability To Put Some Of Your Config Info In Another Config File When Using Aspnet#

    Here is a article talking about the ability to put some of your .config info in another config file when using asp.net

    http://www.beansoftware.com/ASP.NET-Tutorials/Multiple-Config.aspx

    What I found most interesting is that it says that changing the otherFile.config will not reset your app.

    I am guessing that it also means that it won't find your new values until the app is reloaded, but if it DID find the new values w/o a reload that would be great.

    <?xml version="1.0"?>
    <configuration>
        <appSettings/>
        <connectionStrings/>
        <system.web>
            <compilation debug="false" strict="false" explicit="true" />
        </system.web>
        <appSettings file="externalSettings.config"/>
    </configuration>

    I also wonder if you could have more than 1 appSettings external file.

    Categories: Programming | .Net | ASP.Net
    Thursday, July 20, 2006 3:52:58 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Activate Flash, Movies, and other ActiveX controls#

    Recently Microsoft lost a patent judgement, which resulted in them pushing down an "update" to IE that forces you to click on any embedded object to "activate" it.

    Embedded objects can be flash movies, video clips, audio, etc.

    This is really bad for sites that use flash.  Things like navigation and rollovers don't work until you first click on them.

    This article talks about the work around, and how you can incorporate this into your ASP.NET projects.

    http://www.codeproject.com/aspnet/IEActiveXActivation.asp

     

    Categories: Programming | .Net | ASP.Net
    Wednesday, May 24, 2006 1:43:58 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Creating a Sortable BindingList#

    This article from MSDN talks about custom databinding, but specifically it talks about the issues raised when you are trying to databind a custom collection to a datagridview.

    Using a List<T> will work, but when all is said and done you lose some nice features such as sorting.

    Categories: Programming | .Net | .Net Framework | ASP.Net | WinForms
    Wednesday, May 17, 2006 8:43:51 AM (Central Daylight Time, UTC-05:00) #    Comments [1]  | 

     

    Run ASP.NET Web Server From Any Folder#

    Rob McLaws has this cool extension that lets you click on a folder and run a webserver from it.

    The article, with some comments on alternative ways to do it, or ways to improve it can be found here.

    http://weblogs.asp.net/rmclaws/archive/2005/10/25/428422.aspx

    From the page:

    I've been doing some web development work again lately, and I haven't wanted to screw with setting up IIS on my virtual machine. The .NET Framework 2.0 comes with a built-in webserver, based on the old Cassini web server. So I wanted to be able to easily set up any directory to have its contents served up on an as-needed basis. The result is an addition to the Windows Explorer right-click menu, as shown below:

    This is enabled by a simple modification to the registry. You can take the text below and dump it into a file named "WebServer.reg", and then run it, to immediately get the item in the context menu.

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\VS2005 WebServer]
    @="ASP.NET 2.0 Web Server Here"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\VS2005 WebServer\command]
    @="C:\\Windows\\Microsoft.NET\\Framework\\v2.0.50727\\Webdev.WebServer.exe /port:8080 /path:\"%1\""

    There are a couple caveats to this tool, however:

    1. The web server does not randomly assign a port number, so it has to be hard-coded into the registry.
    2. The web server does not automatically assign a virtual directory, so it will always be "http://localhost:port"
    3. A command prompt window will be spawned, and cannot be closed without closing the web server process.

    Moving foward, there are a couple of options to fix these issues:

    1. Someone who knows more about variables in the registry can help me fix issues #2 and #3
    2. I can build a wrapper executable that solves all three problems
    3. Microsoft can put in a DCR and fix it before it goes gold in a few days.

    #3 is not likely, so I'd love to hear what you think. Hope this trick is useful.

     

    Categories: .Net | .Net Framework | ASP.Net | Tools
    Tuesday, May 09, 2006 3:55:26 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Dropdown1 has a SelectedValue which is invalid because it does not exist in the list of items.#

    'Dropdown1' has a SelectedValue which is invalid because it does not exist in the list of items.
    Parameter name: value

    This error has been a real pain to deal with.  I finally have a work around and a guess at the underlying problem, and because I see that people are having this same problem I thought I would do a little writeup about it.

     

    Obviously, if you look at the actual error message, there are cases when you can get this message and the problem is easy to solve.  e.g. you have a dropdown populated with EmploID values and you try to databind with: 

    Value='<%# Bind("EmployeeName") %>

     
    Well of course that won't work if all your values are integers and you are trying to set the value to "Bill Smith".
     
    But my problem was a bit more complicated.
     
    I was building a web user control (aka ASCX) that was a "Location" dropdown.  The control basically contains a dropdown, and all the necessary logic to populate the dropdown, and I was trying to use this control inside the EditTemplate of a GridView.
     
    To make things more complicated, in this case, I didn't JUST want all the Locations, I also wanted to add a "Please Select" item to the list, with a value of 0.
     
    But I kept getting the error above when the value was supposed to be 0.
     
    I stepped through my code to try to find out what was going on.  I believe the issue is this:
     
    On load, on value set, and on databind I call my "Populate" method.  This method sees if there are items in the dropdown.  If not, it gets a list from the database and binds to the dropdown.  It also checks if there is a "Please Select" item, and adds it if there isn't one.
     
    But still when Dropdown's "DataBound" event was fired the last time, my manually added item had been removed.
     
    So what I think what is happening is that :
    1) I set the dropdown DataSource to a collection of business objects
    2) I add the "Please Select" item
    3) The dropdown is told to databind itself by the Gridview.
    4) The dropdown says... "Oh, I do have a datasource, so I'm going to ditch my current list and rebind to that old collection"
    5) The dropdown says "Holy shnikies, I am supposed to bind to value "0", but I don't have one!!"
     
    I think there are 2 possible solutions.
     
    1) I created an adapter class that only has Id and Description properties that are going to be used by the control, and I wrote a function to take my collection of business objects and build a collection of Adapters (adding my "Please Select") to the list of adapters.  To see what I am talking about I will post this code below.
     
    2) Manually add items to the dropdown instead of databinding, so that when the control is told to databind, it doesn't have a datasource to use.
     
     
    Here is my adapter code:
                '**** In my populate method
    Me.LocationsDropdown.DataSource = LocationAdapter.LocationsToAdapters(locations)
    Me.LocationsDropdown.DataTextField = "LocationDescriptionWithActiveAttribute"
    Me.LocationsDropdown.DataValueField = "LocationId"
    Me.LocationsDropdown.DataBind()



    '*************************************
    '*************************************




    Private Class LocationAdapter
    Public ciLocationId As Integer
    Public csLocationDescriptionWithActiveAttribute As String
    Public Property LocationId() As Integer
    Get
    Return ciLocationId
    End Get
    Set(ByVal value As Integer)
    Me.ciLocationId = Value
    End Set
    End Property

    Public Property LocationDescriptionWithActiveAttribute() As String
    Get
    Return csLocationDescriptionWithActiveAttribute
    End Get
    Set(ByVal value As String)
    Me.csLocationDescriptionWithActiveAttribute = Value
    End Set
    End Property

    Public Sub New(ByVal loc As Location)
    Me.LocationId = loc.LocationId
    Me.LocationDescriptionWithActiveAttribute = loc.LocationDescriptionWithActiveAttribute
    End Sub
    Public Sub New(ByVal Id As Integer, ByVal Desc As String)
    Me.LocationId = Id
    Me.LocationDescriptionWithActiveAttribute = Desc
    End Sub

    Public shared Function LocationsToAdapters(ByVal locations As List(Of Location)) As List(Of LocationAdapter)
    Dim adapters As New List(Of LocationAdapter)
    adapters.Add(New LocationAdapter(0, "--Location"))
    For Each loc As Location In locations
    adapters.Add(New LocationAdapter(loc))
    Next
    Return adapters
    End Function

    End Class
     
     
     
    Categories: Programming | .Net | ASP.Net
    Sunday, May 07, 2006 2:45:48 PM (Central Daylight Time, UTC-05:00) #    Comments [7]  | 

     

    ASP.NET 2.0 Page Life-cycle#

    ASP.NET 2.0 has a added a bunch of extra spots in the page lifecycle for programmers to insert their logic.

    The guys over at www.csharper.net have put together a great list of these events and some notes about them in applicable.

    You can see the article here, or you can click through to my full article where I copied their table.

    Categories: Programming | .Net | ASP.Net | Architecture
    Sunday, April 30, 2006 10:13:38 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Delete the Web Apps DLLs and Everything Works#

    Here is another of my favorite problems with VS2005.

    If I have a Web Application Project.  If I build it (with no errors) then when I try to view it I get the error below.  However,

    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: The type 'Company.Web.Equipment.Global' is ambiguous: it could come from assembly 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\equipment\3f386648\c5a85b94\App_Code.gv_z5p7w.DLL' or from assembly 'C:\Data\Company\Company.Web.Equipment\bin\Company.Web.Equipment.DLL'. Please specify the assembly explicitly in the type name.

    Source Error:

    Line 1:  <%@ Application Inherits="Company.Web.Equipment.Global" Language="VB" %>
    

    Source File: /Equipment/global.asax    Line: 1


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

     

    I don't know why it is only happening with this one web app.

    Very frustrating.

    Update: This has been resolved.  The problem is obvious now.  This was a web application that had been converted to a Web Site Project.  When I tried to reimport the files manually into a new Web Application Project there was one minor, yet major, difference that was causing it to fail.  The "CodeBehind" attribute had been changed to "CodeFile".  I didn't think much of it at the time, but of course this indicates that it is going to actually USE the codefile when the page is accessed.  By having a CodeFile attribute AND compiling the code into a DLL, I was ending up with copies of every class.

    Categories: Programming | .Net | ASP.Net | VS.Net | Rants
    Thursday, April 20, 2006 5:00:08 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Upgrading ASP.NET to 2005? Check your references.#

    Some of my web applications that I have recently upgraded to 2005 at some point had their references changed to point to the DLLs that were already in the bin directory.

    Of course this was causing all kinds of problems with missing DLLs and compile problems.

    Make sure you check your references to see that they are not just pointed back into the bin.

     

    Categories: Programming | ASP.Net | VS.Net
    Thursday, April 20, 2006 4:32:51 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Sending Datasets and Objects Over the Wire: Serialization and XML#

    I have tried to councel against sending datasets across web service calls, but we have a lot of instances where this is being done.

    One of the problems with this is that datasets get bloated when converted to XML.

    So I set out to compare the sizes of:

    1. Serialized List(Of MyType)
    2. Serialized DataTable
    3. Serialized DataSet
    4. XML Serialized Dataset

    I wish I had done some research on this, because I would have quickly been reminded that DataSets always serialize as XML, even if you are using the BinaryFormatter. 

    There are lots of people out there coming up with their own ideas for how to improve the serialization of datasets:

    Anyway, this isn't really THAT big of a deal, because my real goal wasn't to improve the dataset serialization, but to simply see what it would be, and compare it to some other ways to serialize data, like in a list of business objects or a datatable.

    The results are interesting:

    Given a list of 1013 Business Objects (Records) the serialization results are as follows:

    Method Size (bytes)
    List(Of MyType) 290,321
    DataTable 819,575
    DataSet 693,088
    XML Serialzied Dataset 851,614

    I have read that you can really decrease the size of the dataset by writing your own logic to do the serialization, but as everyone points out that is kind of a pain.


    Categories: Interesting | Programming | .Net | ASP.Net | WebServices | XML
    Thursday, April 20, 2006 1:44:19 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Upgrading to 2005 Continuing To Be A Pain#

    I decided to go with Scott Gu's suggestion to use Web Application Projects to help ease the conversion for 2003.

    I will agree that this is a much better way to convert your project than to turn it into a Web Site Project, but there are still lingering problems.

    In one of my projects the web page and code behind have somehow become lost.  The code behind pages can't see their controls, which are placed in some mystery file thanks to the new Partial Class feature.

    I tried ranaming the files, I tried cutting and then replacing the HTML that defines the controls, the only thing I found that works is to totally delete the file and recreate it exactly the same way.  What a pain.

    The "What a pain" concept is the only constant in this process.

    I am still not sure what is going on with project references. 

    As far as I see, if there is a DLL in the bin directory, you don't need a reference to that DLL.  But as soon as you clean out your bin, your project will break with error messages that are nothing like "Are you missing a reference?" because, of course you are, VS.Net just removes them all the time w/o asking you! 

    There must be some new paradigm with how you are supposed to work with references, projects, and solutions, because trying to do it like you would in vs.net 2003 is causing a ton of problems.

    Update: Almost as if VS was getting back at me, as soon as I posted this it took a crap and crashed.  :-)

    Categories: Programming | .Net | ASP.Net | Rants
    Monday, April 17, 2006 6:16:34 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    From Asp.net 1.1 to 2.0: Parser Error - Could not load type 'xyz.Global'#

    As we were upgrading to run ASP.Net 2.0, we ran into this wonderful problem.  Your code seems to run fine until you push it to a server and you get this error:

     Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Could not load type 'xyz.Global'.
    Source Error:

    Line 1:  <%@ Application Inherits="xyz.Global" Language="VB" %>
    
    Source File: /global.asax    Line: 1

    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

     

    There are 2 things I had to remember to do to get this to work.

    1) We use a domain user for the aps.net worker process, so our site can access UNC files across the network.  In order for this user to have the ability to compile the app, you have to give them full rights to: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 and if you start running your apps in .net 2.0, you need to do the same for c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727.

    2) If you have any web apps running in 1.1, there is a good chance that even thought you changed the iis setting to asp.net 2.X, you are still running against an app pool that is shared with another site using asp.net 1.1.  So, just create a new app pool, and have your newly 2.0 site setup to use that app pool.

    Problem solved!

    Categories: Programming | .Net | ASP.Net
    Thursday, April 13, 2006 6:05:37 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Running ASP.NET Development Server Without Virtual Path, From Root#

    I had been looking for a way to get the asp.net development server to run w/o a virtual directory settings.  It's really very stupid and short sighted to not enable this.  Just about every project I have ever worked on has some paths coded into the HTML that are based on / being the root, not the application root.  Stupid.

     

    Anyway, ScottGu posted these steps on his site, and it works.  Not bad!

    Step 1: Select the “Tools->External Tools” menu option in VS or Visual Web Developer.  This will allow you to configure and add new menu items to your Tools menu.

     

    Step 2: Click the “Add” button to add a new external tool menu item.  Name it “WebServer on Port 8080” (or anything else you want).

     

    Step 3: For the “Command” textbox setting enter this value: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE (note: this points to the web-server that VS usually automatically runs).

     

    Step 4: For the “Arguments” textbox setting enter this value: /port:8080 /path:$(ProjectDir)

     

    Step 5: Select the “Use Output Window” checkbox (this will prevent the command-shell window from popping up.

     

     Once you hit apply and ok you will now have a new menu item in your “Tools” menu called “WebServer on Port 8080”.  You can now select any web project in your solution and then choose this menu option to launch a web-server that has a root site on port 8080 (or whatever other port you want) for the project.

     

    You can then connect to this site in a browser by simply saying http://localhost:8080/.  All root based references will work fine.

     

    Step 6: The last step is to configure your web project to automatically reference this web-server when you run or debug a site instead of launching the built-in web-server itself.  To-do this, select your web-project in the solution explorer, right click and select “property pages”.  Select the “start options” setting on the left, and under server change the radio button value from the default (which is use built-in webserver) to instead be “Use custom server”.  Then set the Base URL value to be: http://localhost:8080/

    Categories: Code Links | ASP.Net | VS.Net
    Wednesday, April 12, 2006 1:42:57 PM (Central Daylight Time, UTC-05:00) #    Comments [3]  | 

     

    HttpFilter and HttpModules#
    Here is another article on the topic, but they cover the use of an HttpModule instead, which is supposed to make it so you don't have to manually install the HttpFilter in your code.
    Categories: ASP.Net
    Thursday, April 06, 2006 8:50:10 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    IIS and ASP.NET#
    This article talks about how requests are dealth with by IIS and ASP.NET, and how after requests are passed to ASP.NET, how they are handled internally by various httpHandlers.
    Categories: ASP.Net | IIS
    Friday, March 24, 2006 7:24:08 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Encrypting the Viewstate#
    This article from MSDN talks a lot about utilizing the viewstate to its fullest.

    One of the things that they discuss is security, and encrypting the viewstate.
    Categories: Programming | .Net | ASP.Net | Security | Cryptography
    Monday, March 22, 2004 2:33:49 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Test Driven Development with NUnit#
    NUnit is supposed to help with TDD and writing test scripts. I also found a link to ASP.NET addin which I guess I'll need for working with ASP.NET.(?)

    Here is another MSDN article... but there is a newer on in the lastest MSDN magazine... but I guess that isn't online.
    Categories: Programming | .Net | ASP.Net | Testing | Tools
    Wednesday, March 17, 2004 10:49:07 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Screen Scraping Email Blocker#
    This article shows how to create a control that will convert your email addresses into a unique code that is reconverted by javascript when the page loads... so it can't be screen scraped.
    Categories: Code Links | Email | Programming | .Net | ASP.Net | HTML | Javascript | Security
    Saturday, March 13, 2004 9:37:02 PM (Central Standard Time, UTC-06:00) #    Comments [1]  | 

     

    Improvement to RegisterClientScriptBlock ?#
    This article is supposed to offer some improvements to the RegisterClientScript functions. I didn't really read it though.
    Categories: Programming | .Net | ASP.Net | Javascript
    Thursday, February 05, 2004 8:32:08 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    ASP.NET Base Pages#
    Here is a page that shows how to create a base page that inherits the asp.net page class so that each page can automatically have the same functionality and layout.
    Categories: Programming | .Net | ASP.Net
    Friday, January 30, 2004 11:15:11 AM (Central Standard Time, UTC-06:00) #    Comments [1]  | 

     

    Secure Querystrings#
    Secure Querystrings is something that I have seen in practice, but I didn't know that it was built into the .NET Framework. Pretty cool.
    Categories: Programming | .Net | ASP.Net | Security | Cryptography | Secure Coding
    Friday, January 30, 2004 11:03:09 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Indexing Services queries from ASP.NET#
    Here is a good example for doing this.
    Categories: Programming | .Net | ASP.Net
    Thursday, January 29, 2004 4:37:01 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Creating a Bi-Directional HTTP Connection#
    Here is a pretty nice looking article on creating an open socket connection using HTTP with .NET.
    Categories: Programming | .Net | ASP.Net
    Thursday, January 29, 2004 10:03:39 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    ASP.NET and VSS#
    MS has put out this little KB article about using VSS and ASP.NET.

    For the most part I figured out all the stupid things about VSS and ASP.NET on my own... over a pain staking amount of time.
    Categories: Programming | .Net | ASP.Net | Rants
    Tuesday, January 27, 2004 10:27:34 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Add Watermarks At Runtime#
    Here is the article.
    Categories: Programming | .Net | ASP.Net | Security
    Friday, January 16, 2004 11:46:24 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Whidbey Master and Content pages#
    Here is an article that talks about the new Master and Content features of Whidbey.
    Categories: Programming | .Net | ASP.Net
    Monday, January 12, 2004 6:57:14 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    ASP.NET Tournament Brackets#
    This is a company that sells a tournament bracket componet. Looks cool.
    Categories: Code Links | Programming | .Net | ASP.Net | Tools | Tennis Charter
    Wednesday, January 07, 2004 1:41:35 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    HTTP Compression for ASP.NET#
    Here and here are 2 commerical components to enable HTTP compression. This is a little tutorial for doing it with IIS6, and this is a free (as in beer) control that someone wrote.
    Categories: Programming | .Net | ASP.Net
    Friday, January 02, 2004 1:55:38 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Global Error Handling and Reporting#
    Here is a neat looking tutorial for adding error handling and reporting to an asp.net application.
    Categories: Programming | .Net | ASP.Net
    Friday, December 26, 2003 6:26:52 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Preventing Dictionary Attacks#
    This article talks about preventing dictionary attacks with asp.net applications.
    Categories: Programming | .Net | ASP.Net | Security | Secure Coding
    Friday, December 26, 2003 6:22:57 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Using the Principal and Identity for custom security authentication#
    This article shows how to use the .NET Principal and Identity concepts to implement custom authentication and authorization in Windows and Web applications
    Categories: Programming | .Net | ASP.Net | Security | Authentication
    Friday, December 26, 2003 6:15:14 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Some Cool Stuff#
    Here are some products that are going to be coming out soon (Jan 2004).

    The ones that appear interesting to me are the "ASP.NET Forums Configurator" and the "WebSense" (web.config intellisense).

    The Scrolling Grid PLUS is supposed to merge the scrolling grid with their GenX product. I'm going to look at it and will post if it looks cool.
    Categories: Code Links | Programming | .Net | ASP.Net | Tools
    Friday, December 05, 2003 9:35:16 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Scrolling Datagrid#
    For $10 these guys are selling a scrolling datagrid that extends the existing datagrid.

    Pretty cool, and cheap.
    Categories: Programming | .Net | ASP.Net | HTML | Javascript | Tools
    Friday, December 05, 2003 9:31:59 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    80 ASP.NET Articles#
    Here is a link to 80 Articles on ASP.NET.
    Categories: Programming | .Net | ASP.Net | References
    Tuesday, December 02, 2003 3:15:59 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Extending Rainbow White Paper#
    Categories: Code Links | Programming | .Net | ASP.Net | C# | References | Web Site Links
    Wednesday, November 05, 2003 1:08:48 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Sending Data as an XML/HTML Excel Document#
    This article shows how to send data as an xml/html Excel document. The user can then view it in IE, or choose to edit it in Excel (all functions come along when you do the Excel editing.
    Categories: Programming | .Net | ASP.Net | HTML | XML
    Wednesday, November 05, 2003 10:40:51 AM (Central Standard Time, UTC-06:00) #    Comments [1]  | 

     

    ASP.NET Forums for DNN (Maybe Rainbow Portal?)#
    Adverageous.com is selling a packaged ASP.NET Forums into DNN for 50 bucks. Maybe they will port this to Rainbow, or maybe I could?
    Categories: Programming | .Net | ASP.Net | Tools
    Tuesday, November 04, 2003 12:56:36 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

     

    Common Header and Footer#
    I havn't read this article yet... but probabaly should.
    Categories: Programming | .Net | ASP.Net
    Wednesday, September 17, 2003 1:14:18 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Another Date and Time Selector#
    Here is another date and time selector. The time portionn of it is kinda weak, but it does do nice auto completion. Maybe something to look at in the client side script.
    Categories: Programming | .Net | ASP.Net | Tools
    Monday, September 08, 2003 1:23:28 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Date AND Time Selector Controls#
    This control package is the first one I have see that has a seperate popup menu for the Time element of a Date Time. I'm more interested in Time than Date at this point, so this looks interesting.
    Categories: Programming | .Net | ASP.Net | Tools
    Sunday, September 07, 2003 10:20:10 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Nice date picker and various other free controls#
    This site has a pretty nice date picker control, along with a few others, such as a control that does a countdown to an event.
    Categories: Programming | .Net | ASP.Net | Tools
    Sunday, September 07, 2003 10:14:03 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Corey Hulen ComboBox -- Tries to match what you type with listbox.#
    When you start to type in the textbox, a listbox appears and tries to narrow down its list based on your entries. It is supposed to be OSS, and available here.
    Categories: Programming | .Net | ASP.Net | Tools
    Sunday, September 07, 2003 10:10:46 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Pretty cool Date Picker control#
    This control is pretty slick, but kinda expensive at 90 bucks for a single license.
    Categories: Programming | .Net | ASP.Net | Tools
    Friday, September 05, 2003 1:56:00 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Force HTTPS for a Website in IIS#
    This article from IISFaq basically explains a method for forcing HTTPS. You require IIS to use HTTPS, and then you put a redirect page in and assign that page to be the 403 default page. Article is here.
    Categories: ASP.Net | IIS
    Tuesday, September 02, 2003 10:00:19 PM (Central Daylight Time, UTC-05:00) #    Comments [3]  | 

     

    ASP.NET Making a button submit on press of the Enter key#
    Man this is dumb.

    In order to make a button work like a form submit button you need to add the following line of code to the page load event

    RegisterHiddenField("__EVENTTARGET", Me.cmdButton.ClientID)

    Where cmdButton is the ID of the button.
    Categories: Programming | .Net | ASP.Net
    Thursday, August 21, 2003 1:54:50 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Calling JavaScript Before PostBack#
    If you want to have some Javascript run before your ASP.NET controls do their postback, you can do it like this:

    myDeleteButton.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this value?');")
    Categories: Programming | .Net | ASP.Net | Javascript
    Friday, July 25, 2003 1:27:26 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    CC Processing#
    I have been looking into more options for online CC processing. I am using www.v-share.com for this release of Tennis Charter, because it allows me to do real-time issuing of unlock codes. Pretty nice, and it isn't very expensive.

    In the future, I am looking toward other things, like maybe using .netCharge, which is a .net component that you use to interface with various processors/gateways. For the money, ($125), I'm not sure it is really worth it. It's features are: Seamless Integration (ok so I am saved a few lines of code... only a few), Common Interface (ok, you can switch processors without changing code.. some value here), Logging (text logs.. good again), AVS Support (this is really provided by the processor), Card Verification Code (again, just passing data to the processors), Transaction Types (real-time, authorization, processing, void, refund... ok), Test mode, Timeouts, Returns and Error codes, Prevalidation, Database Logging (very cool, it encrypts the data and puts it in a SQL Server... pretty cool), etc..

    Ok, it is pretty cool. But lots of these features are lost of people that arn't running a "WebStore".

    One of the processors it works with is http://www.authorizenet.com which is one of the few companies to describe (technically) how their stuff works. Most sites describe it like "Customer enters credit card information. Credit card information is sent to our servers" blah blah blah.

    If you are lost, this diagram might help explain it.
    Categories: Programming | .Net | ASP.Net | Tennis Charter
    Wednesday, July 16, 2003 2:02:30 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    MetaBuilder.com -- Excellent ASP.NET Control Site#
    This site, MetaBuilder.com has a bunch of free controls, including source code. One of the controls was a combo box of sorts, that has an auto complete feature.
    Categories: Programming | .Net | ASP.Net | Tools
    Saturday, July 05, 2003 2:28:01 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Store Passwords and Connection Strings Securly#
    This article shows how to store passwords and connection strings securly on your machine.
    Categories: Code Links | Programming | .Net | ASP.Net | Cryptography | Security
    Thursday, July 03, 2003 2:50:17 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    WebCombo.NET#
    This control is pretty awsome. It basically allows you to have intellisense or autocomplete type lookups from your applications and datagrids.

    Pretty cool, but $500/developer is kinda stiff.
    Categories: Programming | .Net | ASP.Net | Tools
    Monday, June 30, 2003 5:46:04 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Modifying an Image in ASP.NET#
    Here is a link...
    Categories: Programming | .Net | ASP.Net
    Monday, June 30, 2003 4:56:57 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Adding Javascript From ASP.NET Controls#
    I was having some trouble trying to manually add a giant block of Javascript from an ASP.NET Web Control.

    Without testing it yet, I believe that this solves the problem by using IsClientBlockRegistered.
    Categories: Programming | .Net | ASP.Net | Javascript
    Thursday, June 19, 2003 10:49:55 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    ASP.NET Calander Of Events Control#
    This control is pretty cool. I might consider it.
    Categories: Code Links | Programming | .Net | ASP.Net | Tools
    Tuesday, June 17, 2003 9:31:18 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Easy Picture Gallery#
    Easy Picture Gallery is a pretty sweet ASP.NET image gallery control. Only 19.95.
    Categories: Programming | .Net | ASP.Net
    Sunday, June 15, 2003 10:35:43 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Some ASP.Net Controls#
    This collection of ASP.NET controls looks interesting, and its under $100 bucks.

    Suprising that they don't have a demo for all of them but they look pretty cool.
    Categories: Programming | .Net | ASP.Net | Tools
    Wednesday, June 11, 2003 8:36:29 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

     

    Nice ASP.NET Date Selector#
    I found this pretty slick Date Picker Control from TrueGeeks.com. It uses dropdowns, and is smart on the client side to change the dropdowns so when you select Feb as the month, it will only show you 28 days in the Day dropdown, unless you are on a leap year, then it will give you 29.
    Categories: Programming | ASP.Net | Tools
    Thursday, May 29, 2003 11:33:03 AM (Central Daylight Time, UTC-05:00) #    Comments [2]  | 

     

    All content © 2010, Christopher May, Inc
    Open Job Positions
    On this page
    Customizing Style of RadGrid Edit Items
    SSRS report fails with vertical text
    ASP.NET Apps Recycling Because of FCN Issues
    Using Asyncronous Tasks In ASP.NET
    Regenerating the designer.vb and designer.cs files
    Webservices: The request failed with HTTP status 400: Bad Request
    Putting code in server controls attributes
    Careful With Those Cookies
    Generating Resx Files For Globalization and Localization
    Model View Presenter Guidance From MS Patterns and Practices
    FancyUpload Component
    Globalization and Localization in ASP.NET
    e.Item.Dataitem is nothing?
    VS.NET Extensions for Sharepoint
    Highslide
    BoundFields, DataFormatString, and HtmlEncode
    Using a STYLE block on a page with a Master Page
    What could cause this casting error?
    Using Redirects The Right Way For SEO
    WebAii Website Automated Testing Framework
    Free Flyout and Alternating Panel Controls
    ASP.NET Application Not Reading The Web.Config File
    Solution for "Thread was being aborted" exception when you call Response.End (or .Redirect)
    ScottGu Demos Upcoming MVC Framework for ASP.NET
    404s on ASP.NET AJAX script files in the System.Web.Extensions folder
    Subsonic MVC Templates. Not what I was expecting.
    ASP.NET "How Do I" Videos
    Microsoft P&P Software Factories
    Nice NUnitASP writeup.
    Refactor! for ASP.NET
    Asp.net Label vs Literal
    Rhino Mocks
    Drill Through Reports using Report Viewer and ASP.NET 2.0
    ASP.NET AJAX Errors
    ASP.NET Upload Component
    ASP.NET Process Recycling Too Often
    ASP.NET Design Patterns
    ASP.NET RegularExpressionValidator with Phone Extension Numbers
    AutoSuggest Lookup Control... getting closer
    Upgrading to ASP.NET AJAX, xhtmlConformance, and JavaScript Errors
    Gridview, DateFormatString, and HtmlEncoding
    .Net Search Engine
    Default Buttons in ASP.NET 2.0
    Solution to dasBlog "Remember My Login" Not Working
    SmartNavigation with Metabuilders Combobox
    Extending the Atlast AutoComplete Extender
    Debug = true in web.config files
    Data Driven Checkbox (Horizontal) Lists
    Rocky Lhotka and Csla.Net/Asp.Net on DnrTV
    PostBackUrl And SmartNavigation Bug?
    Using Postbacks in ASP.NET From showModalDialog pages.
    Databinding "Bind()" in ASP.NET
    Here Is A Article Talking About The Ability To Put Some Of Your Config Info In Another Config File When Using Aspnet
    Activate Flash, Movies, and other ActiveX controls
    Creating a Sortable BindingList
    Run ASP.NET Web Server From Any Folder
    Dropdown1 has a SelectedValue which is invalid because it does not exist in the list of items.
    ASP.NET 2.0 Page Life-cycle
    Delete the Web Apps DLLs and Everything Works
    Upgrading ASP.NET to 2005? Check your references.
    Sending Datasets and Objects Over the Wire: Serialization and XML
    Upgrading to 2005 Continuing To Be A Pain
    From Asp.net 1.1 to 2.0: Parser Error - Could not load type 'xyz.Global'
    Running ASP.NET Development Server Without Virtual Path, From Root
    HttpFilter and HttpModules
    IIS and ASP.NET
    Encrypting the Viewstate
    Test Driven Development with NUnit
    Screen Scraping Email Blocker
    Improvement to RegisterClientScriptBlock ?
    ASP.NET Base Pages
    Secure Querystrings
    Indexing Services queries from ASP.NET
    Creating a Bi-Directional HTTP Connection
    ASP.NET and VSS
    Add Watermarks At Runtime
    Whidbey Master and Content pages
    ASP.NET Tournament Brackets
    HTTP Compression for ASP.NET
    Global Error Handling and Reporting
    Preventing Dictionary Attacks
    Using the Principal and Identity for custom security authentication
    Some Cool Stuff
    Scrolling Datagrid
    80 ASP.NET Articles
    Extending Rainbow White Paper
    Sending Data as an XML/HTML Excel Document
    ASP.NET Forums for DNN (Maybe Rainbow Portal?)
    Common Header and Footer
    Another Date and Time Selector
    Date AND Time Selector Controls
    Nice date picker and various other free controls
    Corey Hulen ComboBox -- Tries to match what you type with listbox.
    Pretty cool Date Picker control
    Force HTTPS for a Website in IIS
    ASP.NET Making a button submit on press of the Enter key
    Calling JavaScript Before PostBack
    CC Processing
    MetaBuilder.com -- Excellent ASP.NET Control Site
    Store Passwords and Connection Strings Securly
    WebCombo.NET
    Modifying an Image in ASP.NET
    Adding Javascript From ASP.NET Controls
    ASP.NET Calander Of Events Control
    Easy Picture Gallery
    Some ASP.Net Controls
    Nice ASP.NET Date Selector
    Google Ads
    This site
    Calendar
    <March 2010>
    SunMonTueWedThuFriSat
    28123456
    78910111213
    14151617181920
    21222324252627
    28293031123
    45678910
    Archives
    Sitemap
    Blogroll OPML
    Disclaimer

    Powered by: newtelligence dasBlog 2.3.9074.18820

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

    Send mail to the author(s) E-mail

    Theme design by Jelle Druyts


    Pick a theme: