Advertisements
RSS

Tag Archives: VB.NET

JavaScript: Cookies


A cookie is a variable that is stored on the user’s computer. You can use Javascript to create and retrieve cookie values.

To create a cookie:


function setCookie(sCookieName, sCookieValue)
{
var oCookieExpiryDate = null;
try
{
oCookieExpiryDate = new Date();
if (oCookieExpiryDate == null)
{
return -1;
}
oExpiryDate.setTime(oCookieExpiryDate.getTime() + (1000 * 60 * 60 * 24 * 30)); //30 days
document.cookie = sCookieName + "=" + sCookieValue + "; path=/" + ((oCookieExpiryDate == null) ? "" : "; expires=" + oCookieExpiryDate.toGMTString());
}
catch(e)
{
}
finally
{
}
}

To get the value of a cookie:


function getCookie (sCookieName)
{
try
{
var sCookieNameEQ = sCookieName + "=";
var oCookiesArray = document.cookie.split(';');
for(var i=0;i < oCookiesArray.length;i++)
{
var oCookieItem = oCookiesArray[i];
while (oCookiesArray.charAt(0)==' ')
{
oCookieItem = oCookieItem.substring(1,oCookieItem.length);
}
if (oCookieItem.indexOf(sCookieNameEQ) == 0)
{
return oCookieItem.substring(sCookieNameEQ.length,oCookieItem.length);
}
}
return null;
}
catch(e)
{
}
finally
{
}
}

 

Advertisements
 
Leave a comment

Posted by on October 10, 2012 in Programming

 

Tags: , , , , , , , , , , , ,

ReportViewer Error : Operation is not valid due to the current state of the object


I was getting this error in my ASP.NET application when I try to load a report into the report viewer control. To solve this I used the Reset() method of the report viewer control.



oReportViewer.Reset()
oReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
oReportViewer.Visible = True
oReportViewer.ServerReport.ReportServerUrl = New System.Uri(sReportServiceURL)
oReportViewer.ServerReport.ReportPath = sReportName
oReportViewer.ShowParameterPrompts = False
oReportViewer.ShowDocumentMapButton = False
oReportViewer.DocumentMapWidth = 0
oReportViewer.ShowDocumentMapButton = False
oReportViewer.ShowFindControls = False
oReportViewer.ServerReport.Refresh()

 
Leave a comment

Posted by on September 27, 2012 in Programming

 

Tags: , , , , , , , , , ,

Malahide Beach

Programming Languages

What do you use for programming? I mainly use VB.Net, I used and enjoyed C#. And as a web developer I used JavaScript. I remember doing some php long time ago. In the university I used Assembly, Fortran, and VB 6.0

But I only speaks two languages

Malahide Beach

Malahide Beach

 
Leave a comment

Posted by on September 23, 2011 in Photography

 

Tags: , , , , , , , , , , ,

Updating Select Options using JQuery


So you implemented a webservice that return an ArrayList to update the Select Option.


Public Shared Function UpDateSelectList(ByVal sThemeID As String) As ArrayList


You can use the jQuery $.ajax to call the webservice


$.ajax({
type: "POST",
url: swebserviceURL,
data: oData,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: jsGetArrayListSucess,
failure: function (response)
{
alert("An error was encountered");
}
});


In the callback function you need go through the array list to create an option item and add it to the Select Options


function jsGetArrayListSucess(response)
{
try
{
var DictionaryItems = response.d;
if (DictionaryItems == null || typeof (DictionaryItems) != "object") {
return;

}

var myDropDownList = $get('SelectList');
myDropDownList.options.length = 0;
myDropDownList.options[0] = new Option("Select ", 0);
for (var i = 0; i < DictionaryItems.length; ++i)
{
myDropDownList.options[myDropDownList.options.length] = new Option(DictionaryItems[i].Text, DictionaryItems[i].Value);
}

}
catch (err)
{

}
finally
{

}
}

 
Leave a comment

Posted by on March 3, 2011 in Programming

 

Tags: , , , , ,

VB.NET: Missing menu items in Visual Studio 2005

I noticed that some menu items are missing in Visual Studio 2005, I was mainly looking for the Build Menu Items

To fix this:

  • Click Tools, then click Import and Export Settings

  • In the Import and Export Settings Wizard, click Import selected environment settings, and click Next

  • Select Yes, save my current settings, then click Next

  • Select Visual Basic Development Settings, then click Next

  • Click Finish

  • The Import completed successfully

  • The Build menu looks much better now

 
1 Comment

Posted by on September 3, 2010 in Programming

 

Tags: , , , ,

Using ASP.NET Mobile Forms

I wanted to use the normal ASP.NET Forms stuff in a mobile form.

  • Right click on the web site project and select Add new Item

1

  • Select Mobile Web Form. enter a name for the form and click on Add button

2

  • To use a style sheet & a JavaScript file, I added a DeviceSpecific with SupportJavaScript Filter. this is how the HTML code looks like

3 

  • Now I wanted to created some ASP controls. so I added another DeviceSpecific with isHTML32 Filter. this is how the HTML code looks like

4

 

  • One last thing, in order to make those DeviceSpecific Filters to work you need to add the required keys in the web.config file. this is how this would look like

untitled

 
2 Comments

Posted by on February 5, 2010 in Programming

 

Tags: , , , , , , , , , , , , , , ,

GridView: Wrong Fields Order

 

I was working on a GridView that is binding to a custom class collection to display its properties. the fields in the GridView were ordered depending on the order of the properties in the Class. everything was working fine. until I moved the code to a different development environment.

In the new development environment the order of the GridView fields was not as expected. after spending a lot of time trying to fix that. I installed the .NET 2.0 service pack 2 and that solved the problem!!!!

You can download the .NET 2.0 SP2 from here

http://www.microsoft.com/downloads/details.aspx?familyid=5B2C0358-915B-4EB5-9B1D-10E506DA9D0F&displaylang=en

 
Leave a comment

Posted by on January 27, 2010 in Programming

 

Tags: , , , , , , ,

 
%d bloggers like this: