»
S
I
D
E
B
A
R
«
+
More
Recent News and Links
  • No bookmarks avaliable.
Conversion from type ‘DBNull’ to type ‘String’ is not valid
Jun 1st, 2009 by webpaws

In a VB.net application, retrieving variables from a database, if the value was null, it would cause the error, “Conversion from type ‘DBNull’ to type ‘String’ is not valid”.  A work-around to stop this error was to create a function that would evaluate the imported database variable for a null value as an object then convert it to a string for use without error in your code.

Here is the VB.net code:


Function checkNull(Byval variable as object) as String
If IsDBNull(varialbe) Then
Return("")
Else
Return (variable)
End If
End Function

VN:F [1.8.4_1055]
Rating: 6.8/10 (4 votes cast)
VN:F [1.8.4_1055]
Rating: -1 (from 1 vote)
 
Allow page redirect from an asp:linkbutton in an Ajax ModalPopupExtender
Aug 8th, 2008 by webpaws

Inside a modalpopupextender panel, you need to add and set the UseSubmitBehavior to false for the OK/Cancel controls to be enabled with postback to behave outside of the ajax control.

Example:

<asp:LinkButton ID="OkButton" runat="server" Text="Button Text" UseSubmitBehavior="false" PostBackUrl="product.aspx?id=3" />

You can also use OnClick in the button to perform an action outside of ajax with UseSubmitBehavior=”false”.

VN:F [1.8.4_1055]
Rating: 7.0/10 (3 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)
 
»  Substance: WordPress   »  Style: Ahren Ahimsa
© Copyright by WebPaws.com 2009. All Rights Reserved.

WebPaws.com is Digg proof thanks to caching by WP Super Cache