<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rock &#124; Paper &#124; Web Technical Journal</title>
	<atom:link href="http://rockpaperweb.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://rockpaperweb.com/blog</link>
	<description>VB.Net, ASP.Net, C#.Net, Dot Net Nuke, Word Press, HTML, Javascript, jQuery, SQL Server, My SQL...whatever I know will gradually be part of this blog.  It &#34;should&#34; work...I mean, it works on my machine.</description>
	<lastBuildDate>Mon, 07 May 2012 01:44:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>SQL Server says: Saving Changes Not Permitted</title>
		<link>http://rockpaperweb.com/blog/2012/05/sql-server-says-saving-changes-not-permitted/</link>
		<comments>http://rockpaperweb.com/blog/2012/05/sql-server-says-saving-changes-not-permitted/#comments</comments>
		<pubDate>Mon, 07 May 2012 01:44:36 +0000</pubDate>
		<dc:creator>Cliff Richardson</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[sql server]]></category>

		<guid isPermaLink="false">http://rockpaperweb.com/blog/?p=99</guid>
		<description><![CDATA[If you&#8217;ve run into this error then you&#8217;ve probably recently set up a new installation of SQL Server Management Studio.Â  You then made a change to a table and to your horror this error popped up: Frustrating, isn&#8217;t it.Â  But &#8230; <a href="http://rockpaperweb.com/blog/2012/05/sql-server-says-saving-changes-not-permitted/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve run into this error then you&#8217;ve probably recently set up a new installation of SQL Server Management Studio.Â  You then made a change to a table and to your horror this error popped up:</p>
<p style="text-align: left;"><a href="http://rockpaperweb.com/blog/wp-content/uploads/2012/05/ChangesNotPermitted-Error.png"><img class="size-full wp-image-100 aligncenter" title="ChangesNotPermitted Error" src="http://rockpaperweb.com/blog/wp-content/uploads/2012/05/ChangesNotPermitted-Error.png" alt="" width="539" height="430" /></a>Frustrating, isn&#8217;t it.Â  But the solution is a simple one.Â  Cancel out of that dialog and click OK and the follow up pop (that&#8217;s fun to say).</p>
<p style="text-align: left;">In the menu of Management Studio select <strong>Tools</strong>, then <strong>Options</strong></p>
<p style="text-align: left;"><a href="http://rockpaperweb.com/blog/wp-content/uploads/2012/05/ChangesNotPermitted-Menu.png"><img class="aligncenter size-full wp-image-101" title="ChangesNotPermitted Menu" src="http://rockpaperweb.com/blog/wp-content/uploads/2012/05/ChangesNotPermitted-Menu.png" alt="" width="337" height="120" /></a>On the options dialog select <strong>Designers</strong> and then <strong>Table and Database Designers</strong>.Â  Uncheck the option: <strong>Prevent saving changes that require table re-creation</strong>.</p>
<p style="text-align: left;"><a href="http://rockpaperweb.com/blog/wp-content/uploads/2012/05/ChangesNotPermitted-Options1.png"><img class="aligncenter size-full wp-image-103" title="ChangesNotPermitted Options" src="http://rockpaperweb.com/blog/wp-content/uploads/2012/05/ChangesNotPermitted-Options1.png" alt="" width="500" height="291" /></a>Click <strong>OK</strong> and now you can save your table changes.</p>
]]></content:encoded>
			<wfw:commentRss>http://rockpaperweb.com/blog/2012/05/sql-server-says-saving-changes-not-permitted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DotNetNuke and the Tab Module Drop Down</title>
		<link>http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-the-tab-module-drop-down/</link>
		<comments>http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-the-tab-module-drop-down/#comments</comments>
		<pubDate>Wed, 21 Mar 2012 17:30:02 +0000</pubDate>
		<dc:creator>Cliff Richardson</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[DotNetNuke]]></category>
		<category><![CDATA[Tabs]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[DropDown]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[Pages]]></category>

		<guid isPermaLink="false">http://rockpaperweb.com/blog/?p=97</guid>
		<description><![CDATA[Every build something you&#8217;re certain you need, finish it, and then realize there&#8217;s a better way, but you love the solution so much you can just trash it?Â  That&#8217;s the origin of this post.Â  I&#8217;m sure I&#8217;ll need this later &#8230; <a href="http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-the-tab-module-drop-down/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Every build something you&#8217;re certain you need, finish it, and then realize there&#8217;s a better way, but you love the solution so much you can just trash it?Â  That&#8217;s the origin of this post.Â  I&#8217;m sure I&#8217;ll need this later so I don&#8217;t want to just delete but I can&#8217;t leave it in my project because then I&#8217;ll forget why it&#8217;s there and shouldn&#8217;t be and then try to use and create an unmitigated coding mess.</p>
<p>I know you developers have been there.</p>
<p>But I can&#8217;t just throw it away, so here it is for all to enjoy.</p>
<p>Ever needed to use the Tab Module drop down that DotNetNuke uses to put modules on a page?Â  I did.</p>
<p>Start with a user control and put this code on the presentation page</p>
<pre>&lt;asp:Label runat="server" ID="lblErr" ForeColor="White"&gt;&lt;/asp:Label&gt;
&lt;asp:UpdatePanel runat="server" ID="upTabs" ChildrenAsTriggers="true"&gt;
Â Â Â  &lt;Triggers&gt;
Â Â Â Â Â Â Â  &lt;asp:AsyncPostBackTrigger ControlID="ddlTabs" EventName="SelectedIndexChanged" /&gt;
Â Â Â  &lt;/Triggers&gt;
Â Â Â  &lt;ContentTemplate&gt;
Â Â Â Â Â Â Â  &lt;asp:Label runat="server" ID="lblModErr"&gt;&lt;/asp:Label&gt;
Â Â Â Â Â Â Â  &lt;asp:DropDownList runat="server" ID="ddlTabs" AutoPostBack="true"&gt;
Â Â Â Â Â Â Â  &lt;/asp:DropDownList&gt;
Â Â Â Â Â Â Â  &lt;asp:DropDownList runat="server" ID="ddlModules"&gt;
Â Â Â Â Â Â Â  &lt;/asp:DropDownList&gt;
Â Â Â  &lt;/ContentTemplate&gt;
&lt;/asp:UpdatePanel&gt;</pre>
<p>And this code belongs in the code behind</p>
<pre>Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
  If Not Page.IsPostBack Then
    ddlTabs.DataSource = TabController.GetPortalTabs(Me.PortalId, -1, True, Localization.GetString("DefaultPagesListItem.Text", LocalResourceFile), True, False, False, True, True)
Â    ddlTabs.DataValueField = "TabID"
Â    ddlTabs.DataTextField = "IndentedTabName"
Â    ddlTabs.DataBind()
  End If
Catch exc As ExceptionÂ Â Â  'Module failed to load
  ProcessModuleLoadException(Me, exc)
End Try
End Sub

Protected Sub ddlTabs_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlTabs.SelectedIndexChanged
Try
  ddlModules.Items.Clear()

Â  Dim objModules As New ModuleController
Â  Dim tabModules As Dictionary(Of Integer, ModuleInfo) = objModules.GetTabModules(ddlTabs.SelectedValue)
Â  Dim result As New Dictionary(Of String, Integer)

Â  For Each tabModule In tabModules.Values
Â Â   ddlModules.Items.Add(New ListItem(tabModule.ModuleTitle, tabModule.ModuleID))
Â  Next
Catch ex As Exception
  lblModErr.Text = ex.Message
End Try
End Sub</pre>
<p>Simple and yet no one else seems to have it on one page.Â  Now, at long last, well, not long last, but here it is!</p>
]]></content:encoded>
			<wfw:commentRss>http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-the-tab-module-drop-down/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RowDataBound and the Generic List!  You know you&#8217;re curious.</title>
		<link>http://rockpaperweb.com/blog/2012/03/rowdatabound-and-the-generic-list-you-know-youre-curious/</link>
		<comments>http://rockpaperweb.com/blog/2012/03/rowdatabound-and-the-generic-list-you-know-youre-curious/#comments</comments>
		<pubDate>Wed, 21 Mar 2012 17:18:38 +0000</pubDate>
		<dc:creator>Cliff Richardson</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Generic List]]></category>
		<category><![CDATA[no default member]]></category>
		<category><![CDATA[RowDataBound]]></category>

		<guid isPermaLink="false">http://rockpaperweb.com/blog/?p=68</guid>
		<description><![CDATA[The Generic list is becoming my best friend although I couldn&#8217;t conclusively tell you why I&#8217;m enjoying using it more than a standard dataset.Â  At any rate, one of the issues I ran into with the Generic list was reference &#8230; <a href="http://rockpaperweb.com/blog/2012/03/rowdatabound-and-the-generic-list-you-know-youre-curious/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The Generic list is becoming my best friend although I couldn&#8217;t conclusively tell you why I&#8217;m enjoying using it more than a standard dataset.Â  At any rate, one of the issues I ran into with the Generic list was reference fields on a GridView&#8217;s RowDataBound event.</p>
<p>With a dataset you would reference a field this way:</p>
<p>e.Row.DataItem(&#8220;FieldName&#8221;)</p>
<p>But when using a generic list you&#8217;ll get an error along the lines of</p>
<pre>No default member found for {myclass}</pre>
<p>Here&#8217;s how to set up the RowDataBound event when using a Generic List.</p>
<pre>If e.Row.RowType = DataControlRowType.DataRow Then
Â  Dim obj As MyNameSpace.MyListInfo = CType(e.Row.DataItem, MyNameSpace.MyListInfo)
Â  Dim myVal as string = obj.MyField

Â  --any other code here---
End If</pre>
<p>In this case &#8220;MyNameSpace&#8221; is the namespace&#8230;go figure&#8230;and MyListInfo is the class containing all the properties that correspond to fields in your table.</p>
<p>This is one of the reasons I love the list so much: I don&#8217;t have to remember all the names of the fields because they&#8217;ve all been turned into properties.</p>
<p>More to come on the Generic List!</p>
]]></content:encoded>
			<wfw:commentRss>http://rockpaperweb.com/blog/2012/03/rowdatabound-and-the-generic-list-you-know-youre-curious/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DotNetNuke and Custom Permissions</title>
		<link>http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-custom-permissions/</link>
		<comments>http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-custom-permissions/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 23:46:45 +0000</pubDate>
		<dc:creator>Cliff Richardson</dc:creator>
				<category><![CDATA[DotNetNuke]]></category>
		<category><![CDATA[Modules]]></category>
		<category><![CDATA[custom permissions]]></category>
		<category><![CDATA[DotNetNuke 5]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://rockpaperweb.com/blog/?p=93</guid>
		<description><![CDATA[While creating my ownÂ  DotNetNuke 5 modules I found myself adding all kinds of custom permission in the code, but then the admin users didn&#8217;t have any access to change them.Â  I found myself having to update the code every &#8230; <a href="http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-custom-permissions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>While creating my ownÂ  DotNetNuke 5 modules I found myself adding all kinds of custom permission in the code, but then the admin users didn&#8217;t have any access to change them.Â  I found myself having to update the code every time they wanted to add, or remove, a role from a particular permission.</p>
<p>There&#8217;s a better way.Â  In DotNetNuke 5 you can piggyback on the existing permissions functionality.</p>
<p>Let&#8217;s say we&#8217;re creating a module called Assets and we need a custom permission that allows particular users and roles to assign the asset to other users.Â  The standard &#8220;View Module&#8221; and &#8220;Edit Module&#8221; won&#8217;t get us there.</p>
<p>1.First create your customer module and include an App_Code folder.</p>
<p>2. The first thing we need to do is create a class called &#8220;Module Security&#8221; and place it in the App_Code folder of our module.Â  The code for the module looks like this (see notes below the code for explanation):</p>
<pre>Imports Microsoft.VisualBasic
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Security.Permissions

Namespace MyModules.Modules.Asset
Â Â Â  Public Class ModuleSecurity
Â Â Â Â Â Â Â  'Constants
Â Â Â Â Â Â Â  Public Const PERMISSIONCODE As String = "MYMOD_ASSET" Â Â Â Â Â Â Â
        Public Const PN_ASSIGN As String = "ASSET_ASSIGN"Â Â Â Â Â Â Â  

        'private variables
Â Â Â Â Â Â Â  Private _ASSIGN As Boolean = False

Â Â Â Â Â Â Â  Private _moduleInfo As ModuleInfo

Â Â Â Â Â Â Â  Sub New(ByVal moduleInfo As ModuleInfo)
Â Â Â Â Â Â Â Â Â Â Â  ' TODO: Complete member initialization
Â Â Â Â Â Â Â Â Â Â Â  _moduleInfo = moduleInfo
Â Â Â Â Â Â Â Â Â Â Â  ModuleSecurity(moduleInfo)
Â Â Â Â Â Â Â  End Sub

Â Â Â Â Â Â Â  Public Sub ModuleSecurity(ByVal moduleInfo As ModuleInfo)
Â Â Â Â Â Â Â Â Â Â Â  Dim permCollection As ModulePermissionCollection = moduleInfo.ModulePermissions
Â Â Â Â Â Â Â Â Â Â Â  _ASSIGN = ModulePermissionController.HasModulePermission(permCollection, PN_ASSIGN)
Â Â Â Â Â Â Â  End Sub

Â Â Â Â Â Â Â  Public ReadOnly Property ASSIGN As Boolean
Â Â Â Â Â Â Â Â Â Â Â  Get
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  Return _ASSIGN
Â Â Â Â Â Â Â Â Â Â Â  End Get
Â Â Â Â Â Â Â  End Property

Â Â Â  End Class
End Namespace</pre>
<p>PermissionCode: This is the Group label for the permissions. All permissions for the module should have the same PermissionCode</p>
<p>PN_Assign: The nomenclature here is &#8220;Permission Name Assign&#8221;.Â  I use this for each permission.Â  Another permission might be PN_Retire &#8211; to retire an asset.</p>
<p>2. In your DotNetNuke database use this format and run the following query for each permission you create</p>
<pre>Insert into Permission(PermissionCode, ModuleDefID, PermissionKey, PermissionName, ViewOrder, CreatedByUserID, CreatedOnDate, LastModifiedByUserID, LastModifiedOnDate)
Select '{PermissionCode}', ModuleDefID, '{PermissionKey}', '{PermissionName}', 10000, 1, GETDATE(), 1, GETDATE() Â
from ModuleDefinitions Where FriendlyName = '{Asset}'</pre>
<p>For our example the query would like this:</p>
<pre>Insert into Permission(PermissionCode, ModuleDefID, PermissionKey, PermissionName, ViewOrder, CreatedByUserID, CreatedOnDate, LastModifiedByUserID, LastModifiedOnDate)
Select 'MYMOD_ASSET', ModuleDefID, 'ASSET_ASSIGN', 'Assign Asset', 10000, 1, GETDATE(), 1, GETDATE() Â
from ModuleDefinitions Where FriendlyName = 'Asset'</pre>
<p>The ViewOrder should start at 10000 because DotNetNuke reserves 0-9999 for DotNetNuke permissions.</p>
<p>3. To use the permission in your module put in some code like this:</p>
<pre>'At Module level
Private msSecurity As ModuleSecurity
Private msAssign As Boolean = False

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    msSecurity = New ModuleSecurity(Me.ModuleConfiguration)
Â Â Â  msAssign = Convert.ToBoolean(msSecurity.ASSIGN)
Â Â Â
Â Â Â  'on our page we have an ASP:Button called btnAssignÂ Â Â Â Â Â Â Â Â Â Â
Â Â Â  if msAssign Then btnAssign.Visible = False
End Sub</pre>
<p>4. The last piece is set up the DotNetNuke module manifest to automatically insert the permissions into the database when the module is installedÂ  The manifest file should look like this:</p>
<pre>&lt;moduleDefinitions&gt;
Â Â Â  &lt;moduleDefinition&gt;
Â Â Â  Â  Â  &lt;moduleControls&gt;
Â Â Â Â Â Â Â Â Â Â Â   --module definitions deleted for brevity----
Â Â Â Â Â Â Â  &lt;/moduleControls&gt;
Â Â Â Â Â Â Â  &lt;permissions&gt;
Â Â  Â  Â Â Â Â Â Â  &lt;permission code="ATPI_ASSET" key="ASSET_ASSIGN" name="Assign Asset" /&gt;
Â Â Â Â Â Â Â  &lt;/permissions&gt;
Â Â Â  &lt;/moduleDefinition&gt;
&lt;/moduleDefinitions&gt;</pre>
<p>And that should do it.Â  Now you&#8217;re permissions should show up in the Settings of your module with the DotNetNuke permissions, they should be accessible in your module, and they should automatically populate when the module is installed using the DotNetNuke Extension installer.</p>
]]></content:encoded>
			<wfw:commentRss>http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-custom-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DotNetNuke and BC30002: Type &#8216;{type}&#8217; is not defined</title>
		<link>http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-bc30002-type-type-is-not-defined/</link>
		<comments>http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-bc30002-type-type-is-not-defined/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 22:18:20 +0000</pubDate>
		<dc:creator>Cliff Richardson</dc:creator>
				<category><![CDATA[DotNetNuke]]></category>
		<category><![CDATA[Modules]]></category>
		<category><![CDATA[BC30002]]></category>
		<category><![CDATA[codeSubdirectories]]></category>
		<category><![CDATA[type not defined]]></category>

		<guid isPermaLink="false">http://rockpaperweb.com/blog/?p=89</guid>
		<description><![CDATA[I recently ran into this problem: I have a DotNetNuke module that logs activity via a previously installed module.Â  Several of my existing modules call the logging module without a problem, but then I created a new module and after &#8230; <a href="http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-bc30002-type-type-is-not-defined/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently ran into this problem: I have a DotNetNuke module that logs activity via a previously installed module.Â  Several of my existing modules call the logging module without a problem, but then I created a new module and after I installed it I&#8217;m getting the error BC30002: Type &#8216;Log.LogController&#8217; is not defined.</p>
<p>I scratched my head for quite a while on this one.Â  Looked all over the web without luck until I came across a note that caused me to investigate the web.config.Â  The suggested solution didn&#8217;t resolve the problem, but I did notice something else.Â  The new module that I had installed, using the DotNetNuke install process, was listed in theÂ codeSubDirectories section of the Web.Config, but the Log module was not.</p>
<p>I had installed the Log module manually; meaning I just pushed up the files, ran the SQL script and added the extension and it&#8217;s controls by hand in the extensions section of DotNetNuke.Â  Since I installed it manually an entry in codeSubDirectories was never created.</p>
<p>On a lark, I manually added the Log module to the codeSubDirectories and my error went away.</p>
<p>Conclusion: When a custom module is listed in theÂ codeSubDirectories section any custom module listed as a dependency in the manifest file must also be listed in the codeSubDirectories section.</p>
]]></content:encoded>
			<wfw:commentRss>http://rockpaperweb.com/blog/2012/03/dotnetnuke-and-bc30002-type-type-is-not-defined/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RegisterClientScriptBlock, RegisterStartupScript and the AJAX Update Panel</title>
		<link>http://rockpaperweb.com/blog/2012/02/registerclientscriptblock-registerstartupscript-and-the-ajax-update-panel/</link>
		<comments>http://rockpaperweb.com/blog/2012/02/registerclientscriptblock-registerstartupscript-and-the-ajax-update-panel/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 15:23:28 +0000</pubDate>
		<dc:creator>Cliff Richardson</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[DotNetNuke]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ClientScript]]></category>
		<category><![CDATA[ScriptManager]]></category>
		<category><![CDATA[UpdatePanel]]></category>

		<guid isPermaLink="false">http://rockpaperweb.com/blog/?p=84</guid>
		<description><![CDATA[It&#8217;s very frustrating when Microsoft products don&#8217;t work with Microsoft products and the server side client script is one of those frustrating situations. Normally, if I need to fire off a client script server side I would do it like &#8230; <a href="http://rockpaperweb.com/blog/2012/02/registerclientscriptblock-registerstartupscript-and-the-ajax-update-panel/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very frustrating when Microsoft products don&#8217;t work with Microsoft products and the server side client script is one of those frustrating situations.</p>
<p>Normally, if I need to fire off a client script server side I would do it like this:</p>
<ol>
<li>An asp:Button called myButton has been clicked on the page</li>
<li>The following event is fired:
<pre>Private Sub myButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles myButton.Click
     'Do some server side processing

     Dim script as String = ""
     script = "&lt;script language='javascript' id='myScript'&gt;"
     script += "alert('some alert text');"
     script += "&lt;/script" + "&gt;"

     If Not ClientScript.IsClientScriptBlockRegistered("myScript") then ClientScript.RegisterClientScriptBlock(System.Type.GetType("System.String"), "myScript", script)
End Sub</pre>
</li>
<li>If you&#8217;re building you&#8217;re application in DotNetNuke replace that last line calling the ClientScript with this line:
<pre>If Not Page.ClientScript.IsClientScriptBlockRegistered("myScript") Then Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), Guid.NewGuid().ToString(), script)</pre>
</li>
</ol>
<p>But, if myButton is included as a trigger on an Update Panel then the ClientScript won&#8217;t fire.Â  The Update Panel itself is firing client side code which will keep ClientScript from being added to the view state and firing.</p>
<p>Instead, use ScriptManager:</p>
<pre>Private Sub myButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles myButton.Click
     'Do some server side processing

     Dim script as String = ""
     script = "&lt;script language='javascript' id='myScript'&gt;"
     script = +"alert('some alert text');"
     script = +"&lt;/script" + "&gt;"

     ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), script, True)
End Sub</pre>
<p>For more detailed info: <a href="http://wiki.asp.net/404.aspx?aspxerrorpath=/themes/fan/pages/page.aspx/1574/differences-between-registerclientscriptblock-amp-registerstartupscript-and-how-they-work-with-ajax-update-panel/" target="_blank">Differences between RegisterClientScriptBlock &amp; RegisterStartupScript and how they work with AJAX Update Panel</a></p>
]]></content:encoded>
			<wfw:commentRss>http://rockpaperweb.com/blog/2012/02/registerclientscriptblock-registerstartupscript-and-the-ajax-update-panel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dot Net Nuke and the &#8220;Remember Me&#8221; option</title>
		<link>http://rockpaperweb.com/blog/2012/01/dot-net-nuke-and-the-remember-me-option/</link>
		<comments>http://rockpaperweb.com/blog/2012/01/dot-net-nuke-and-the-remember-me-option/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 15:59:53 +0000</pubDate>
		<dc:creator>Cliff Richardson</dc:creator>
				<category><![CDATA[DotNetNuke]]></category>
		<category><![CDATA[Cookies]]></category>
		<category><![CDATA[Remember Me]]></category>

		<guid isPermaLink="false">http://rockpaperweb.com/blog/?p=80</guid>
		<description><![CDATA[The DotNetNuke &#8220;Remember Me&#8221; option on the log in page has always been a bit of mystery because it doesn&#8217;t quite do what you would expect it to do.Â  I expected that when I clicked it on future logins the &#8230; <a href="http://rockpaperweb.com/blog/2012/01/dot-net-nuke-and-the-remember-me-option/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The DotNetNuke &#8220;Remember Me&#8221; option on the log in page has always been a bit of mystery because it doesn&#8217;t quite do what you would expect it to do.Â  I expected that when I clicked it on future logins the fields would be filled in automatically and I would just click the login button.Â  But that&#8217;s not what it does and so it never really &#8220;appeared&#8221; to work.</p>
<p>However, there&#8217;s been a fix using the PersistentCookieTimeOut option.Â  Once set in the web.config the user will be automatically logged in; that is, the login page will be bypassed and the user will be immediately directed to the home page.Â  To clear this option the user simply does a manual log out instead of just closing the browser.</p>
<p>For some sites this is a problem.Â  You wouldn&#8217;t want this on your banking site, for example.Â  Someone just has to open your computer, go to the page, and they are in!Â  However, for other work flows its not so much an issue.Â  Say you are in and out of the site all day and don&#8217;t want to have to keep logging in, but at the end of the day you officially log out.</p>
<p>Here&#8217;s the code to make it happen:</p>
<p>In the web.config add the following line to the &lt;appSettings&gt; section</p>
<p>&lt;add key=&#8221;PersistentCookieTimeout&#8221; <strong>value=&#8221;20160&#8243;</strong> /&gt;</p>
<p>Where 20160 is two weeks in minutes, but you can set it to whatever you like.</p>
<p>For more information see this post by Cathal Connolly at DotNetNuke: <a title="Remember Me fix" href="http://www.dotnetnuke.com/Resources/Blogs/EntryId/1784/a-new-solution-to-an-old-problem.aspx" target="_blank">New Solution to An Old Problem</a></p>
]]></content:encoded>
			<wfw:commentRss>http://rockpaperweb.com/blog/2012/01/dot-net-nuke-and-the-remember-me-option/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server: Group records by Week</title>
		<link>http://rockpaperweb.com/blog/2012/01/sql-server-group-records-by-week/</link>
		<comments>http://rockpaperweb.com/blog/2012/01/sql-server-group-records-by-week/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 16:02:23 +0000</pubDate>
		<dc:creator>Cliff Richardson</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[datepart]]></category>
		<category><![CDATA[group by]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[week]]></category>

		<guid isPermaLink="false">http://rockpaperweb.com/blog/?p=76</guid>
		<description><![CDATA[Quick code snippet to group a recordset by week.Â  In this case we are summing hours worked per week. SELECT DATEPART(YEAR,myDateField) AS 'Year', Â Â Â Â Â Â Â Â Â Â  DATEPART(wk,myDateField) AS 'Week #', Â Â Â Â Â Â Â Â Â Â  MIN(DATEADD(wk, DATEDIFF(wk,0,myDateField), 0)) AS 'Week date', Â Â Â Â Â Â Â Â Â Â  SUM(COALESCE([Hours],0)) AS 'Hours' FROM &#8230; <a href="http://rockpaperweb.com/blog/2012/01/sql-server-group-records-by-week/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Quick code snippet to group a recordset by week.Â  In this case we are summing hours worked per week.</p>
<pre>SELECT DATEPART(YEAR,myDateField) AS 'Year',
Â Â Â Â Â Â Â Â Â Â  DATEPART(wk,myDateField) AS 'Week #',
Â Â Â Â Â Â Â Â Â Â  MIN(DATEADD(wk, DATEDIFF(wk,0,myDateField), 0)) AS 'Week date',
Â Â Â Â Â Â Â Â Â Â  SUM(COALESCE([Hours],0)) AS 'Hours'
FROM myTable
GROUP BY DATEPART(YEAR,myDateField),DATEPART(wk,myDateField)
ORDER BY 1,2</pre>
]]></content:encoded>
			<wfw:commentRss>http://rockpaperweb.com/blog/2012/01/sql-server-group-records-by-week/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Approve&#8221; Multiple records in a GridView</title>
		<link>http://rockpaperweb.com/blog/2011/12/approve-multiple-records-in-a-gridview/</link>
		<comments>http://rockpaperweb.com/blog/2011/12/approve-multiple-records-in-a-gridview/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 15:24:27 +0000</pubDate>
		<dc:creator>Cliff Richardson</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[Button]]></category>
		<category><![CDATA[CheckBox]]></category>
		<category><![CDATA[DataKeyNames]]></category>
		<category><![CDATA[DataRow]]></category>
		<category><![CDATA[GridView]]></category>

		<guid isPermaLink="false">http://rockpaperweb.com/blog/?p=74</guid>
		<description><![CDATA[Every once in a while you have a list of records that need to be &#8220;approved by a manager.&#8221;Â  You could select the records via a filter, but that always gets a little cumbersome because there&#8217;s always one record you &#8230; <a href="http://rockpaperweb.com/blog/2011/12/approve-multiple-records-in-a-gridview/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Every once in a while you have a list of records that need to be &#8220;approved by a manager.&#8221;Â  You could select the records via a filter, but that always gets a little cumbersome because there&#8217;s always one record you have to then individually &#8220;un-approve&#8221; in order to get it just right.</p>
<p>In this example we put a CheckBox on each row, allow the user to select whichever records they want to approve and then approve them with the click of a button.</p>
<p>1) Build your GridView and display your data. The following code only applies to the current page, so if your GridView allows paging you will want to balance between showing too many records versus showing enough records for an efficient approval process.Â  Make sure you set the DataKeyNames field to your Table&#8217;s Identity field.</p>
<p>2) Add the following row to your GridView:</p>
<pre>&lt;asp:TemplateField&gt;
Â Â Â  &lt;ItemTemplate&gt;
Â Â Â  Â  Â  &lt;asp:CheckBox runat="server" ID="chkApprove" /&gt;
Â Â Â  &lt;/ItemTemplate&gt;
&lt;/asp:TemplateField&gt;</pre>
<p>3) Add a button to your page</p>
<pre> &lt;asp:Button runat="server" ID="btnApprove" Text="Approve Selected" /&gt;</pre>
<p>4) Add the code to iterate through the GridView records to the Button Click event.</p>
<pre>Protected Sub btnApprove_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnApprove.Click
01 Â  Try
02 Â Â Â Â Â  For Each row As GridViewRow In grdContent.Rows
03 Â Â Â Â Â Â Â Â Â  If row.RowType = DataControlRowType.DataRow Then
04 Â Â Â Â Â Â Â Â Â Â Â Â Â  Dim cChk As CheckBox = CType(row.FindControl("chkApprove"), CheckBox)
05 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  If cChk.Checked Then
06 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  ApproveMyRecord(grdContent.DataKeys(row.RowIndex).Value)
07 Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  End If
08 Â Â Â Â Â Â Â Â Â  End If
09 Â Â Â Â Â  Next
10 Â  Catch ex As Exception
11 Â Â Â Â  lblMsg.Text = "Approve error: " &amp; ex.Message
12 Â Â  End Try
End Sub</pre>
<p>Breakdown:<br />
<strong>Lines 01, 10-12:</strong> Basic Try/Catch error trapping routine.Â  The lblMsg control is arbitrary.Â  Display errors as you see fit.<br />
<strong>Lines 02, 03, 08, 09:</strong> We are iterating through every displayed row in the GridView and checking for DataControlRowType.DataRow rows (this will exclude header and footer rows).<br />
<strong>Line 04:</strong> Create a CheckBox variable and assign the row checkbox to it.<br />
<strong>Line 05, 07:</strong> Check to see if the CheckBox is checked and if not, skip it.<br />
<strong>Line 06</strong>: This is where you run the code to approve the individual record.Â  Grab the record ID from the DataKeys using the RowIndex value.</p>
<p>You can improve this code by collecting the ID&#8217;s and sending them to a Stored Procedure as a list and reducing the number of calls to the database.</p>
]]></content:encoded>
			<wfw:commentRss>http://rockpaperweb.com/blog/2011/12/approve-multiple-records-in-a-gridview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL &#8211; Creating and Dropping Temp Tables</title>
		<link>http://rockpaperweb.com/blog/2011/12/sql-creating-and-dropping-temp-tables/</link>
		<comments>http://rockpaperweb.com/blog/2011/12/sql-creating-and-dropping-temp-tables/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 18:14:32 +0000</pubDate>
		<dc:creator>Cliff Richardson</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[stored procedures]]></category>
		<category><![CDATA[tables]]></category>
		<category><![CDATA[temp tables]]></category>

		<guid isPermaLink="false">http://rockpaperweb.com/blog/?p=71</guid>
		<description><![CDATA[I run into this all the time but can&#8217;t ever remember the syntax. First, check to see if it exists and if it does, drop it. IF OBJECT_ID('tempdb..#MyTempTable') IS NOT NULL Drop Table #MyTempTable Second, build your table.Â  The &#8220;#&#8221; &#8230; <a href="http://rockpaperweb.com/blog/2011/12/sql-creating-and-dropping-temp-tables/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I run into this all the time but can&#8217;t ever remember the syntax.</p>
<p>First, check to see if it exists and if it does, drop it.</p>
<pre>IF OBJECT_ID('tempdb..#MyTempTable') IS NOT NULL
Drop Table #MyTempTable</pre>
<p>Second, build your table.Â  The &#8220;#&#8221; is important.Â  The &#8220;#&#8221; denotes it as a temp table.Â  Forget the hash and you&#8217;ll be creating permanent tables in your database every time the code runs.</p>
<pre>Create Table #MyTempTable
 ( MyID int,
 Â  MyText varchar(50)
 )</pre>
<p>When creating you&#8217;re table you can include any kind and amount of fields that you can in a regular table. This is just a demo.</p>
<p>At this point you can fill the temp table with records and do whatever queries against it that your code requires as long as they occur in the same context.Â  Once the code stops running the temp table ceases to be available.</p>
<p>Now, go create some temp tables!</p>
]]></content:encoded>
			<wfw:commentRss>http://rockpaperweb.com/blog/2011/12/sql-creating-and-dropping-temp-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

