Active navigation menu for current url
Set the active/current menu link based or Url in Jquery:
suppose we have menu like:
<div class="nav"> <ul> <li class="active"><a href="~/url1/">URL 1</a> <li><a href="~/url2/">URL 2</a> <li><a href="~/url3/">URL 3</a> </ul> </div>and user when clicked on URL 2 then item look as active :$(function(){ var url = window.location.pathname, urlRegExp = new RegExp(url.replace(/\/$/,'') + "$"); $('#nav a').each(function(){ if(urlRegExp.test(this.href.replace(/\/$/,''))){ $(this).addClass('active'); } }); });
Wrap Label Text in asp.net
Today I found one issue with my site, that is a label text was not wrapped and display continued. Found finally working solution:
<div style="float:left;overflow-y:auto;overflow-x:auto; word-break:break-all;"> <asp:Label ID="lbDesc" runat="server" /> </div>
asp.net 4.0 web form routing in iis7
Today I have completed my first phase of the project on Asp.Net 4.0 and I have implemented Web Form routing feature. It was working fine on VS inbuilt IIS server but when I deployed on IIS server, it was not working. I did little bit search on Google and finally found working solution. It may help you in future.
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule,
System.Web, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add
name="UrlRoutingHandler"
preCondition="integratedMode"
verb="*" path="UrlRouting.axd"
type="System.Web.HttpForbiddenHandler, System.Web,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
CheckboxList required field validation
Today I came across a situation where I need to validate CheckboxList as required field and found below solution:
//Bound list from Database
<asp:CheckBoxList ID="chlZones" runat="server" RepeatColumns="5"
RepeatDirection="Horizontal" />
//Create Custom validator that will work as required validator. Profile function
<asp:CustomValidator ID="cvalZones" runat="server"
ClientValidationFunction="ValidateZones" ErrorMessage="!!!"
Display="Dynamic" />
//Implement Client method
<script>
function ValidateZones(source, args) {
var chlZones = document.getElementById('');
var chkLista = chlZones.getElementsByTagName("input");
for (var i = 0; i < chkLista.length; i++) {
if (chkLista[i].checked) {
args.IsValid = true;
return;
}
}
args.IsValid = false;
}
</script>
Application Lifecycle Management
Today I found very good article for Project Management activity and how you can manage your project in very effective manner. I would like to share and you must see once this article and follow it:
- Integrated planning
- Traceability of related artifacts
- Development intelligence
- Automation and Collaboration
- Continuous process improvement
IE9 Beta download
Today Microsoft announced IE9 beta released and now available for download in different languages. To get more about it find below URL:
http://www.microsoft.com/presspass/presskits/internetexplorer/
Thanks
Increase website ranking on Google Search
To increase the website ranking, we have to follow the certain rules. Since last few last days I was digging into more to get understand the logic behind the google search engine.
Found the great article which covers all the rules:
http://www.ssw.com.au/SSW/Standards/Rules/RulesToBetterGoogleRankings.aspx#HowGoogleRanksPages
Thanks
JQuery tutorials
Hi Guys, I just want to share good resource for JQuery tutorials for beginner and advanced developers. Please find below link:
http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-video-series/
WCF Endpoint Bindings
What is the WCF Endpoint Bindings
WCf Binding specify how the service can be accessed. Binding can specify not only the protocol used to access the service but an encoding method used to format the message contents. Binding can also specify any security requirements such as Secure Sockets Layer (SSL) or SOAP message security.
Follwing are System provide bindings:
wsFederationHttpBinding
This secure and interoperable binding supports federated security. It supports HTTP and HTTPS transport protocols as well as text and MTOM encoding methods.
netTcpBinding
This secure binding is used to send binary-encoded SOAP messages from one WCF computer to another. It uses Transmission Control Protocol (TCP) and includes support for reliability, transactions, and security.
netNamedPipeBinding
This secure binding should be used on a single WCF computer. Binaryencoded SOAP messages are sent over named pipes.
netMsmqBinding
This queued binding is used to send binary-encoded SOAP messages over MSMQ. Communication should occur between two computers.
netPeerTcpBinding
This secure binding is used for peer-to-peer communication over TCP. Communication should occur between two or more computers.
msmqIntegrationBinding
This interoperable binding can be used for existing MSMQ applications that use COM and native C++ application programming interfaces (APIs).
basicHttpContextBinding
This binding provides support for HTTP cookies and enables SOAP headers to exchange context.
netTcpContextBinding
This secure binding enables SOAP headers to be used in the exchange of content.
wsHttpContextBinding
This secure and interoperable binding enables SOAP headers to exchange context while also supporting reliability, transactions, and security.
The binding you choose also depends on which message-encoding method is required. Some bindings can be encoded as binary, which can yield better performance results. However, binary encoding is not available with all bindings. For services requiring interoperability, plaintext encoding or MTOM is required. Fortunately, you are able to specify multiple endpoints for a service. This means you are not tied to a single method, and the client can use the
best one available.