Category Archives: .NET

Code Snippets .NET ASP.Net 2.0

Pass Array via Query String

http://galhano.com/?var=1&var=2&var=3&var=4

vb sample:

  Dim arr = Request.QueryString("var").Split(",")
  For Each s In arr
    Response.Write("<br />var:" & var)
  Next
Code Snippets .NET ASP.Net

Set Calendar Extender’s SelectedDate=”<%=DateTime%>”

&lt;asp:TextBox ID=&quot;txtDate&quot; runat=&quot;server&quot; &gt;&lt;/asp:TextBox&gt;
&lt;cc1:CalendarExtender ID=&quot;CalendarExtender1&quot; runat=&quot;server&quot; TargetControlID=&quot;txtDate&quot; Format=&quot;MM/dd/yyyy&quot; OnClientShowing=&quot;showDate&quot; &gt; &lt;/cc1:CalendarExtender&gt;
&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
function showDate(sender,args)
{
if(sender._textbox.get_element().value == &quot;&quot;)
{
var todayDate = new Date();
sender._selectedDate = todayDate;
}
}
&lt;/script&gt;
.NET ASP.Net Microsoft

Enterprise Library

The Microsoft Enterprise Library is a collection of reusable software components (application blocks) designed to assist software developers with common enterprise development cross-cutting concerns (such as logging, validation, data access, exception handling, and many others). Application blocks are a type of guidance; they are provided as source code, test cases, and documentation that can be used “as is,” extended, or modified by developers to use on complex, enterprise-level line-of-business development projects.

read more »

Code Snippets .NET Tips & tricks

Code Translation for .NET (C#<->VB.NET)

This service will translate the code for you, just start typing the code or upload a file to convert it.
For now it only supports from VB.NET to C# and from C# to VB.NET.
To use it you can either:

  1. Start typing your code.
  2. Copy and Paste the code in the Code Text Box.
  3. Translate an entire file using the file upload.

Disclaimer: No copy is done whatsoever of the code that you either type, or upload for translation. Everything is processed in the server in memory and returned immediately to the browser.
If you want to give feedback on the translation, please send me an email including the code you used and the desired translation to me@carlosag.net.

http://www.carlosag.net/Tools/CodeTranslator/

see also:

http://www.developerfusion.com/tools/convert/csharp-to-vb/

.NET Charts jQuery

Highcharts .Net (with vb sample)

Highcharts .Net is a charts library written in pure javascript, offering an easy way to add complex charts to your Web application. Highcharts .Net encapsulates the Highcharts API on ASP.net controls making it easier to use.

Project page at codeplex: http://highcharts.codeplex.com

You can see some Highcharts.Net examples at this link: http://highcharts.paulovich.com.br/

Install:

After download the newest release, add it as reference on your web application, and then add it to the page controls on your web.config:

<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add tagPrefix="highchart" namespace="Highchart.UI" assembly="Highchart"/>
</controls>
</pages>

After that, you only need to import the jQuery script.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>

it’s ready to use 😉

aspx:

 

<highchart:columnchart id="hcVendas" width="600" height="400" runat="server"></highchart:columnchart>

VB Sample:


read more »

.NET AJAX

CalendarExtender and globalization

Set the ScriptManager:


&lt;asp:ScriptManager ID=&quot;ScriptManager1&quot; runat=&quot;server&quot; EnableScriptGlobalization=true  &gt;&lt;/asp:ScriptManager&gt;

.NET ASP.Net Google

ASP.NET GoogleMaps User Control

GoogleMaps.Subgurim.NET is the most advanced Google Maps control for ASP.NET 2.0.
Making available the full power of the official GoogleMaps API, yet without the need of a single line of javascript code: you code only in ASP.NET!
To get going, you just drag the control from the toolbox onto the Visual Studio design surface, and with a few lines of code you will be able program powerful Google Maps applications!

http://en.googlemaps.subgurim.net

.NET AJAX ASP.Net 2.0 Microsoft

.NET Framework 4 Chart Controls

You can now download Visual Studio 2010 projects that contain all the samples targeting .NET Framework 4.

The samples environment for Microsoft Chart Controls for .NET Framework contains over 200 samples for both ASP.NET and Windows Forms. The samples cover every major feature in Chart Controls for .NET Framework. They enable you to see the Chart controls in action as well as use the code as templates for your own web and windows applications.

ChartSamples_thumb_1.jpg

The samples environments each contains a Getting Started section to help you start using the Chart controls quickly. The samples demonstrates how to use the following features in Microsoft Chart Controls for .NET Framework:

  • All supported chart types.
  • Data series, chart areas, axes, legends, labels, titles, and more.
  • Data Binding
  • Data manipulation, such as copying, splitting, merging, alignment, grouping, sorting, searching, filtering, and more.
  • Statistical formulas and financial formulas.
  • Advanced chart appearance, such as 3D, anti-aliasing, lighting, perspective, and more.
  • Chart rendering.
  • Events and Customizations.
  • Interactivity and AJAX.

http://archive.msdn.microsoft.com/mschart

.NET ASP.Net 2.0 Microsoft

Remove Black Arrows from horizontal ASP.Net menu

<asp:Menu ID=”Menu1″ runat=”server” DataSourceID=”SiteMapDataSource1″
Orientation=”Horizontal” >

Set:

staticEnableDefaultPopOutImage= False

use your own image:

StaticPopOutImageUrl=”~/images/down_arrow.gif”

.NET ASP.Net 2.0 Chrome

Asp.net menu control not working on Google Chrome

To solve this you will need to tell .net the capabilities of the browser. For .net 2.0 & above you need to create a new browers file with the capabilities and upload it to your server.

  1. In VS2008 Solution Explorer right click your application and add the “ASP.Net Folder” App_Browsers if you don’t already have it.
  2. Add a New “Browser File” item to this special folder and call it safari.browser (if fixing the problem for Chrome)
  3. Delete all the default stuff VS put in this file and replace it with the following:
    <browsers>
    <browser refID=”safari1plus”>
    <controlAdapters>
    <adapter controlType=”System.Web.UI.WebControls.Menu” adapterType=”” />
    </controlAdapters>
    </browser>
    </browsers>
  4. Save your file & test locally to see if all is well.
  5. Now for the annoying bit. Upload the new app_browser folder & file to your production server, if you have used the “copy web site” menu option to upload or sharepoint or frontpage, these will create a new folder under app_browsers called vti_cnf
  6. Manually delete the vti_cnf folder under app_browser on your production server. If you don’t you’ll get “Parse error: Data at the root level is invalid. Line 1, position 1.” in your new safari.browser file.
  7. Remember to manually delete this vti_cnf folder everytime you make a change to the app_browser folder or contained files.

So there you go, how to solve the control rendering problems with Google’s Chrome.

For original post you can visit

http://fabenterprises.wordpress.com/2009/03/21/aspnet-menu-not-rendering-correctly-in-googles-chrome/