17 November 2011

querystring n gv rows in javascript

query string in js: '<%=Request.QueryString["val"]%>';
--------------------------
gridrows in js: Totalrows = parseInt('<%= this.gv1.Rows.Count %>');
--------------------------
var rows = document.getElementById('gv').rows;
for(i=0;i <rows.length;i++)
{
   fd = rows[i].cells[4].innerText;
   rows[i].cells[4].style.display="none";
   rows[i].cells[8].style.display="none";
}

------------------------------------
<asp:Label ID="lblSno" runat="server" Text="<%# Container.DataItemIndex + 1%>"  />    ------------> to get the serial no for the gridview rows after bind the data (take the control to item template field of the grid)

11 November 2011

ws vs wcf

webservices uses XmlSerializer. A Web Service is programmable application logic accessible via standard Web protocols(Simple Object Access Protocol), which uses standards based technologies (XML for data description and HTTP for transport) to encode and transmit application data. consumers only need to understand how to send and receive SOAP messages (HTTP and XML). webservice can be hosted in iis and outside of iis. In Web service System.XML.Serialization is supported while in the WCF Service System.RunTime.Serialization is supported

wcf uses DataContractSerializer. Windows Communication Foundation (WCF) is a framework for building service-oriented applications. for secure applications, chat service that allows two people to communicate, to poll a service for the latest data feeds we use wcf. WCF is a replacement for all earlier web service technologies from Microsoft. An endpoint in WCF can be communicated with just as easily over SOAP/XML,TCP/binary,as this reduces the amount of new code needed.
WCF is flexible because its services can be hosted in different types of applications (IIS,WAS, Self-hosting, Managed Windows Service)

limits of xmlserializer:
----------------------
1.Only the public fields and properties of .NET Framework objects are translated into XML.
2.Hashtable cannot be serialized into XML.
3.Web Services can be accessed only over HTTP & it works in stateless environment