Showing posts with label Venketesh Subramony. Show all posts
Showing posts with label Venketesh Subramony. Show all posts

Tuesday, August 11, 2009

ASP:Menu will not work with IE8 / Chrome / Safari.

An iMIS Tips and Tricks by Venketesh Subramony

Consultant, BroadPoint Technologies

Please add this in Master Page

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >

protected override void AddedControl(Control control, int index)
{
if (Request.ServerVariables["http_user_agent"].IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) != -1)
{
this.Page.ClientTarget = "uplevel";
}
base.AddedControl(control, index);
}

Also use the Browsercap in webconfig

<system.web>
<browserCaps>

<!-- GECKO Based Browsers (Netscape 6+, Mozilla/Firefox, ...) //-->
<case match="^Mozilla/5\.0 \([^)]*\) (Gecko/[-\d]+)(?'VendorProductToken' (?'type'[^/\d]*)([\d]*)/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)))?">
browser=Gecko
<filter>
<case match="(Gecko/[-\d]+)(?'VendorProductToken' (?'type'[^/\d]*)([\d]*)/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)))">
type=${type}
</case>
<case> <!-- plain Mozilla if no VendorProductToken found -->
type=Mozilla
</case>
</filter>
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
ecmascriptversion=1.5
w3cdomversion=1.0
css1=true
css2=true
xml=true
tagwriter=System.Web.UI.HtmlTextWriter
<case match="rv:(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
version=${version}
majorversion=0${major}
minorversion=0${minor}
<case match="^b" with="${letters}">
beta=true
</case>
</case>
</case>

<!-- AppleWebKit Based Browsers (Safari...) //-->
<case match="AppleWebKit/(?'version'(?'major'\d?)(?'minor'\d{2})(?'letters'\w*)?)">
browser=AppleWebKit
version=${version}
majorversion=0${major}
minorversion=0.${minor}
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
ecmascriptversion=1.5
w3cdomversion=1.0
css1=true
css2=true
xml=true
tagwriter=System.Web.UI.HtmlTextWriter
<case match="AppleWebKit/(?'version'(?'major'\d)(?'minor'\d+)(?'letters'\w*))(.* )?(?'type'[^/\d]*)/.*( |$)">
type=${type}
</case>
</case>

<!-- Konqueror //-->
<case match=".+[K|k]onqueror/(?'version'(?'major'\d+)(?'minor'(\.[\d])*)(?'letters'[^;]*));\s+(?'platform'[^;\)]*)(;|\))">
browser=Konqueror
version=${version}
majorversion=0${major}
minorversion=0${minor}
platform=${platform}
type=Konqueror
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
ecmascriptversion=1.5
w3cdomversion=1.0
css1=true
css2=true
xml=true
tagwriter=System.Web.UI.HtmlTextWriter
</case>

<!-- Opera //-->
<case match="Opera[ /](?'version'(?'major'\d+)(?'minor'\.(?'minorint'\d+))(?'letters'\w*))">
<filter match="[7-9]" with="${major}">
tagwriter=System.Web.UI.HtmlTextWriter
</filter>
<filter>
<case match="7" with="${major}">
<filter>
<case match="[5-9]" with="${minorint}">
ecmascriptversion=1.5
</case>
<case>
ecmascriptversion=1.4
</case>
</filter>
</case>
<case match="[8-9]" with="${major}">
ecmascriptversion=1.5
</case>
</filter>
</case>
<case match="Chrome/(?'version'(?'major'\d+)(?'minor'\.\d+)\.\d+.\d+)\sSafari/\d+\.\d+">
browser=Chrome
version=${version}
majorversion=${major}
minorversion=${minor}
</case>
</browserCaps>
<system.web>

Thursday, August 6, 2009

Write a WebService using your notepad

 

An iMIS Tips and Tricks by Venketesh Subramony

Consultant, BroadPoint Technologies

 

You can write a webservice using a notepad editor. Also you can test this using your browser.

You can even test the webservice by browsing the asmx page in the browser.

<%@ WebService Language="C#" class="MyWebService" %>

using System;

using System.Web.Services;

using System.Web;

using System.Web.MySecureInfo;

using System.Web.UI.WebControls;

using System.Data;

using System.Data.SqlClient;

using System.Configuration;

public struct MyInfo

{

public string variables;

}

[WebService(Namespace="http://microsoft.com/webservices/")]

public class MyWebService : WebService

{

private MyInfo MySecureInfo;

public MyWebService()

{

MySecureInfo.variables = "";

}

private void AssignValues(string variables)

{

try

{

// your code

}

catch

{

MySecureInfo.variables= variables;

}

}

[WebMethod(Description="This method call will get the company name and the price for a given MySecureInfo pID.",EnableSession=true)]

public MyInfo GetMyInfo(string pUserid,string pPassword)

{

AssignValues(pUserid,pPassword);

MyInfo MySecureInfoDetails = new MyInfo();

MySecureInfoDetails.variables = MySecureInfo. variables;

return MySecureInfoDetails;

}

}

Tuesday, August 4, 2009

Webservice Easy to implement using JQuery.

An iMIS Tips and Tricks by Venketesh Subramony
Consultant, BroadPoint Technologies

The jQuery code is very simple and easy to learn.

Here are the features of jQuery

1. DOM element selections functions

2. DOM traversal and modification

3. Events

4. CSS manipulation

5. Effects and animations

6. Ajax

7. Extensibility

8. Utilities - such as browser version and the each function.

9. JavaScript Plugins

POST Method

function InfoByDate(sDate, eDate){
var divToBeWorkedOn = '#AjaxPlaceHolder';
var webMethod = 'http:// WebService/Web.asmx/GetInfoByDates'
var parameters = "{'sDate':'" + sDate + "','eDate':'" + eDate + "'}"
$.ajax({
type: "POST",
url: webMethod,
data: parameters,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
$(divToBeWorkedOn).html(msg.d);
},
error: function(e){
$(divToBeWorkedOn).html("Unavailable");
}
});


GET Method

$.get("http://doman.com/webservice.asmx", { name: "John", time: "2pm" },
function(data){
alert("Data Loaded: " + data);
});

Add this

Bookmark and Share