dot net tips, DotNet tips, .Net Tips,Dot Net tips and tricks,Dot Net Solutions, OOPS Concept in C#,SQL Server, LinQ, Ajax, Java script, JQuery, Server Error details, daily .net tips and tricks , DotNet Interview Questions.
how to identify the sql server edition
select serverproperty('edition')
The result will look something like:
32-bit: Enterprise Edition
64-bit: Developer Edition (64-bit)
Determine Size of a Table in SQL Server
sp_spaceused ‘Tablename’How to read child nodes from specific xml file
you need to use here is theXLINQ. After adding the reference to System.Xml.Linq
in your program do write the below code.
XElement companyInfo = XElement.Parse( @"<COMPANYINFO> <CORPORATE ID=""C45RT4C"" NAME=""NEW COMPANY LTD.""> <LOCATION ID=""P88972FC"" NAME=""EASIER""> <SUBLOCATION ID=""S89872FE"" NAME=""400462""/> </LOCATION> <LOCATION ID=""PDRD2905"" NAME=""XT-454560-5""> <SUBLOCATION ID=""SFDF22D7"" NAME=""202743""/> <SUBLOCATION ID=""S106B993E"" NAME=""401048""/> <SUBLOCATION ID=""SDEA2907"" NAME=""507152""/> <SUBLOCATION ID=""123C699"" NAME=""507180""/> <SUBLOCATION ID=""HTY4C896"" NAME=""507205""/> <SUBLOCATION ID=""SFD580DD"" NAME=""600281""/> </LOCATION> <LOCATION ID=""PD1104ED"" NAME=""TD-454560-4""> <SUBLOCATION ID=""211704EF"" NAME=""202724""/> <SUBLOCATION ID=""SFD37943"" NAME=""401056""/> <SUBLOCATION ID=""XDEA2A2D"" NAME=""507169""/> </LOCATION> </CORPORATE> </COMPANYINFO>"); foreach (XElement subLocation in companyInfo.Elements("CORPORATE").Elements("LOCATION").Elements("SUBLOCATION")) { Console.WriteLine(subLocation.Attribute("NAME").Value); }
If condition in Repeater,Listview
while binding data in repeater i need to do a if condition in the same repeater, so i use below one.
<ItemTemplate>
<table>
<div id="Div1" runat="server" visible='<%#Eval("TextA") !="" %>'> // true or false
<tr>
<td style="width:120px;">
<asp:TextBox ID="TextBox1" Text='<%#Eval("AnimalGroup") %>' Width="100" runat="server"></asp:TextBox>
</td>
<td style="width:100px;">
<asp:TextBox ID="txtQno" Text='<%#Eval("QNO") %>' Width="100" runat="server"></asp:TextBox>
</td>
<td style="width:500px;">
<asp:TextBox ID="txtTextA" Text='<%#Eval("TextA") %>' Width="500" runat="server"></asp:TextBox>
</td>
</tr></div>
</table>
</ItemTemplate>
Its working fine..... Thanks
The XML sitemap config file web.sitemap could not be loaded. An error occurred while parsing EntityName
An error occurred while parsing Entity Name. Line xx, position yy.
We should replace below symbols using in SiteMap.Web.
& character should be replaced the entity reference &
< character should be replaced the entity reference <
> character should be replaced the entity reference >
' character should be replaced the entity reference '
" character should be replaced the entity reference "
We should replace below symbols using in SiteMap.Web.
& character should be replaced the entity reference &
< character should be replaced the entity reference <
> character should be replaced the entity reference >
' character should be replaced the entity reference '
" character should be replaced the entity reference "
Consume WebService Using SOAP
Introduction
Web Services are thought of as a means to provide easily accessible services over a network. We can use VS.NET IDE to create a Web Service.While there are different techniques to communicate with a Web Services, SOAP is regarded as the actual standard. SOAP messages are being sent to service endpoints. This can simply be SOAP over HTTP.
Information Regarding Exsiting Web Service
.Asmx file for that WebService (URL):http://localhost/AddNumbers/Service1.asmx
WSDL URL: http://localhost/AddNumbers/Service1.asmx ?wsdl
Namespace of web service: http://localhost/wwwroot/addnumbers/Service1
Method:int AddTwoNumbers (int, int)
Class:Service1
Steps For Consuming Web Service Using SOAP
- Start a new ASP.NET web application.
- Install msxml.msi, then click on “Add reference “ and then select “Interop.MSXML2.dll” and click on add.
You can download the English version of the msxml.msi install file via this link: http://download.microsoft.com/download/7/a/7/7a72ca2e-39cc-4600-ab36-bf3fea876a65/msxml3.msi.
- Create one label to display result (
ID = lablel1). - Declare
objXMLHttpof typeMSXML2.ServerXMLHTTP40.Protected MSXML2.ServerXMLHTTP40 objXMLHttp
- Declare one
string strSoapEnvelopewhich contains soap request.string strSoapEnvelope= “”;
- Create SOAP Envelope
strSoapEnvelopelike this:strSoapEnvelope = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; strSoapEnvelope += "<soap:Envelope "; strSoapEnvelope += "xmlns:xsi = \"http://www.w3.org/2001/XMLSchema-instance\" "; strSoapEnvelope += "xmlns:xsd= \"http://www.w3.org/2001/XMLSchema\" "; strSoapEnvelope += "xmlns:soap= \"http://schemas.xmlsoap.org/soap/envelope/\">"; strSoapEnvelope += "<soap:Body>"; strSoapEnvelope += "<AddTwoNumbers xmlns=\"http://localhost/wwwroot/addnumbers/Service1\">"; strSoapEnvelope +="<a>10</a>"; strSoapEnvelope += "<b>12</b>" strSoapEnvelope += "</AddTwoNumbers >"; strSoapEnvelope += "</soap:Body>"; strSoapEnvelope += "</soap:Envelope>";
- Create an instance of
ServerXMLHTTP40.objXMLHttp = new ServerXMLHTTP40(); - Set the header of SOAP request.
objXMLHttp.open("POST", http://192.168.84.90/AddNumbers/Service1.asmx,false,"","") objXMLHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); objXMLHttp.setRequestHeader("SOAPAction", "http://localhost/wwwroot/addnumbers/Service1/AddTwoNumbers");
- Send the SOAP request.
objXMLHttp.send(strSoapEnvelope.ToString()); - Wait for some time.
objXMLHttp.waitForResponse(500); - Take response in string outXML.
string outXML = objXMLHttp.responseText.ToString(); - Display result in
label(ID= label1):Label1.Text = outXML.ToString();
How to add meta tags in asp.net when using master page
Add meta tags in content pages under master page:
Master page:
<head runat="server">
<asp:Literal ID="ltrCtrl" runat="server"></asp:Literal>
</head>
xxx.aspx.cs Page on pageload
Literal ltr = (Literal)this.Master.FindControl("ltrCtrl");
StringBuilder metatag = new StringBuilder();
metatag.Append("<meta name=\"description\" content=\"description here. \" />");
metatag.Append("<meta name=\"keywords\" content=\"keyword, keywords here\"/>");
ltr.Text = metatag.ToString();
i am using this .. its working fine for me.
Subscribe to:
Posts (Atom)
