Nannette Thacker ShiningStar.net

ASP.net Web Application Development

Sponsors

News

See all Blog Posts by Nannette.

Nannette Thacker, consultant and owner of Shining Star Services LLC, specializes in development of custom dynamic database driven web applications utilizing ASP.net technologies. Nannette has been developing ASP sites since 1997. Nannette has written numerous articles on web development techniques and tutorials.

Nannette is the owner and developer of ChristianSinglesDating.com.

 Subscribe in a reader





View Nannette  Thacker's profile on LinkedIn

March 2009 - Posts

Storing and Retrieving Objects from View State - The Serializable Attribute

View State allows you to retain page property values, such as string and numeric types, between postbacks. You may also store class objects in View State, but you must first add the Serializable attribute. If you do not add the Serializable attribute, you will receive this error when trying to add the object to View State:

Type 'SuchAndSuch.ThisAndThat' in Assembly 'SuchAndSuch, Version 1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable. 

Here is an example of adding Serializable to a class:

<Serializable()>_
Public Class aMenu
   Public MenuName As String
   Public MenuId as Integer
   Public Url as String

  Public Sub New(ByVal menuName as String, ByVal menuId as Integer, ByVal url as String)

   MenuName = menuName
   MenuId = menuId
   Url = url

  End Sub

End Class


The aMenu class can now be added to View State:

Dim myMenu as New aMenu("Home",1,"/default.aspx")
ViewState("myMenu") = myMenu

To use the aMenu object:

If ViewState("myMenu") IsNot Nothing then
   Dim myMenu as aMenu
   myMenu = DirectCast(ViewState("myMenu"),aMenu)
End If

May your dreams be in ASP.NET!

Nannette Thacker

Filtering Parameters in a SQL 2008 Stored Procedure

Ash explains the concept of Filtering Parameters in a Stored Procedure in this blog post.

This method is safer and more beneficial than dynamically creating and passing a sql query from the code layer and using sp_executesql, as it helps to avoid sql injection attacks.

However, the author explains there is a pitfall because you may sacrifice index optimization.

Check it out!

May your dreams be in ASP.NET and your code free from sql injections!

Nannette Thacker

 

Using Icons in Web Design

Nathan Barry posted a new article on How To Use Icons To Support Content In Web Design.

Besides his design insights, he also provides images that depict actual live website examples and links to those sites.

His tips include How to Use Icons, Purpose and Placement, Icon Styles, and numerous examples.

Check it out!

May your dreams be in ASP.NET!

Nannette

 

More Posts