Wednesday 10 March 2010

Referencing ASP.NET Wizard Buttons

Technorati Tags: ,

When you use the StepType of Finish a Finish Button is automatically generated and its ID is “FinishButton”, e.g. the WizardStep looks like this:

<asp:WizardStep ID="ConfirmWizardStep" runat="server" Title="Confirm" StepType="Finish">



Due to a business rule you may wish to disable the Finish button and to do this you would think that a FindControl on the WizardStep would work but it doesn’t as the Button is nested below many other tables/templates etc.



The method I used involved a custom recursive FindControl function as follows:




Dim finishButton As Button = CType(FindControlRecursive(WizardControl, "FinishButton"), Button)




Public Shared Function FindControlRecursive(ByVal root As Control, ByVal id As String) As Control

If root.ID = id Then
Return
root
End If
Dim
c As Control
For Each c In root.Controls
Dim t As Control = FindControlRecursive(c, id)
If Not t Is Nothing Then
Return
t
End If
Next
Return Nothing

Function


Tuesday 6 October 2009

SSIS Lookup Transformation with Date values

 

When comparing Oracle dates to SQL Server I have found that it only works when the Oracle and SQL dates are strings.

Therefore in your Oracle query add a new column like this:

TO_CHAR(SYSDATE,'DD/MM/YYYY') as DATE_STRING

then in your SQL Server query add a new column:

CONVERT(VARCHAR(10), GETDATE(), 103) AS DATE_STRING

You can then map the columns in the Lookup Transform dialog.

Wednesday 30 September 2009

Using SSIS to connect to Oracle

Technorati Tags:

Using the OLE DB Data Source for Oracle you will most likely come across this warning/error message when setting up your OLE DB Data Source:

The component reported the following warnings:

Warning at {EDFCB4B5-2102-4C54-8B8C-DC2362FDAB6B} [OLE DB Source [1]]: Cannot retrieve the column code page info from the OLE DB provider.  If the component supports the "DefaultCodePage" property, the code page from that property will be used.  Change the value of the property if the current string code page values are incorrect.  If the component does not support the property, the code page from the component's locale ID will be used.

The fix is to exit the OLE DB Data Source and then examine its properties. Here you will find a AlwaysUseDefaultCodePage property. Set this to True and all will be good.

Friday 24 July 2009

asp:Menu does not render correctly in Chrome fix

Just add this to your master page:

Protected Overloads Overrides Sub AddedControl(ByVal control As Control, ByVal index As Integer)
If Request.ServerVariables("http_user_agent").IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) <> -1 Then
Me
.Page.ClientTarget = "uplevel"
End If
MyBase
.AddedControl(control, index)
End Sub




Technorati Tags: ,

Tuesday 16 June 2009

AJAX Control Toolkit and DOCTYPE used

 

I was adding Ajax functionality to an ‘old’ asp.net page and was stuck as to why the tab container control was rendering in an strange way, e.g.:

image

It turned out that the DOCTYPE was wrong. To fix the problem I changed from:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">


to



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


the control then rendered as expected:



image



The xhtml doctype is added by default by visual studio so only a problem when enhancing



Technorati Tags: ,


older code.

Wednesday 18 March 2009

Windows App Web References

A simple one which can cause problems when deploying windows apps referencing web services.

Make sure that you web service reference is setup using Dynamic URL Behaviour.

You can see the effect of this in the Reference.vb Sub New, where it reads the path to the web reference from the app.config (as we would like to happen):

image

This is defined as a property of the web reference:

image

If you change the web service property URL Behaviour to Static the Reference.vb Sub New is automatically updated for you by Visual Studio and is then hard coded to your local development machine (not good):

image