Wednesday, 14 November 2012

SSRS:Export to Excel in Individual tabs

 ' Returns a properly formatted list of comma seperated marks
    ' Assumes that the input list is a list of comma seperated values
    ' Adds single quotes around each value and then joins them back together
    Public Function FormattedCommaSeperatedList(ByVal pCommaSeparatedString As String) As String       
        Dim sTokens As String() = pCommaSeparatedString.Split(",")
        Dim iTokenCount As Integer = 0
        FormattedCommaSeperatedList = ""
        If sTokens.Length > 1 Then
            Dim sToken As String
            For Each sToken In sTokens
                'for each token, concat with the single quote and put back into output string
                FormattedCommaSeperatedList = FormattedCommaSeperatedList + "'" + Trim(sToken) + "'"

                If iTokenCount < sTokens.Length - 1 Then
                    FormattedCommaSeperatedList = FormattedCommaSeperatedList + ","
                End If
                iTokenCount = iTokenCount + 1
            Next

        Else
            FormattedCommaSeperatedList = FormattedCommaSeperatedList + "'" + sTokens(0) + "'"
        End If
    End Function

Tuesday, 28 February 2012

Add .svc in MIME type IIS7

1. Add application in IIS7
2. Right click+switch to Features view
3. Double Click on MIME type
4. From Actions--->  click Add











5. .svc and application/octetstream + Click OK
OR
(try from your side.)
1.) a. Cd %systemRoot%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\
b. ServiceModelReg.exe -i
c. ServiceModelReg.exe -r

Thursday, 5 January 2012

Procedure with output parameter

With the help of Enterprise library:
Solution:

 DbCommand cmdDel = _db.GetStoredProcCommand("USP_YOURPROCEDURE");
                _db.AddOutParameter(cmdDel, "@STATUS", DbType.String, int.MaxValue);
                _db.AddInParameter(cmdDel, "@VID", DbType.Int32, HFVID.Value);
                _db.ExecuteDataSet(cmdDel);
               
                lblStatus.Text = cmdDel.Parameters["@STATUS"].Value.ToString();

A name was started with an invalid character. Error processing resource 'http://localhost/WCF...'


<>The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.

A name was started with an invalid character. Error processing resource 'http://localhost/WCFIISService/Service.svc'. Line...
<%@ ServiceHost Service="WCFDefault.Service1" %>

Solution:

IN IIS>Handler Mappings>Add Managed Handlers

Request-path
*.svc

Type:
System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Name
svc-integrated

Friday, 9 December 2011

Opening Outlook with new e-mail from Asp.net

add Outlook reference through com
then include  " using Outlook = Microsoft.Office.Interop.Outlook;  " in header
use the following code for opening outlook with new email

code:

try
        {
            // Create the Outlook application.
            Outlook.Application oApp = new Outlook.Application();

            // Get the NameSpace and Logon information.
            Outlook.NameSpace oNS = oApp.GetNamespace("mapi");

            // Log on by using a dialog box to choose the profile.
            oNS.Logon("Outlook", "", true, true);

            // Alternate logon method that uses a specific profile.
            // TODO: If you use this logon method,
            //  change the profile name to an appropriate value.
            //oNS.Logon("YourValidProfile", Missing.Value, false, true);

            // Create a new mail item.
            Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);

            // Set the subject.
            oMsg.Subject = "Testing";

            // Set HTMLBody.
            String sHtml;
            sHtml = "<HTML>\n" +
               "<HEAD>\n" +
               "<TITLE>Sample GIF</TITLE>\n" +
               "</HEAD>\n" +
               "<BODY><P>\n" +
               "<h1><Font Color=Green>Testing</Font></h1></P>\n" +
               "<P>Testing Testing Testing Testing</P>\n" +
               "<P>Testing Testing Testing Testing</P>\n" +
               "</BODY>\n" +
               "</HTML>";
            oMsg.HTMLBody = sHtml;
          //  oMsg.Attachments.Add(OpenFile(@"C:\MyAttachmentFi.txt"), Outlook.OlAttachmentType.olByValue, Type.Missing, Type.Missing);
            //try for attachments sorry the above code is not working..
           

            // Add a recipient.
            Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
            // TODO: Change the recipient in the next line if necessary.
            Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add("emailid@mail.com");
           
         oRecip.Resolve();
           oMsg.Display(oMsg);  //code for display the outlook
            // Send.
      //    oMsg.Send();    //code for sending

            // Log off.
          oNS.Logoff();

            // Clean up.
            oRecip = null;
            oRecips = null;
            oMsg = null;
            oNS = null;
            oApp = null; 
        }

         // Simple error handling.
        catch (Exception ess)
        {
            Console.WriteLine("{0} Exception caught.", ess);
        } 


screen shot:


Thankyou..:)

Tuesday, 22 November 2011

Remove underline from link button ?

#1 CSS
 .NoUnderLine
   {
      text-decoration: none;
   }
#2 HTML
 <asp:linkbutton id="lnkLogOut" Text="LOGOUT" runat="server" CssClass="NoUnderLine" />

Friday, 11 November 2011

Javascript onBlur function

Desc: When you click on the textbox the value of textbox is cleared by using Javascript
method.
function doEmptytextbox(id, txtVal)
{
         var searchtext = document.getElementById(id).value;
          if (searchtext == txtVal) {
          document.getElementById(id).value = "";
          }
}

function dorestoretextbox(id, txtVal)
{
         var searchtext = document.getElementById(id);

          if (searchtext.value == "") {
          document.getElementById(id).value = txtVal;
          }
}

When TextBox is in Master Page!... code goes like this.

<asp:TextBox ID="txtNcid" runat="server" BackColor="White" ForeColor="Black" Text="(New)/Search"onblur = "return dorestoretextbox('ctl00_MainContent_txtNcid', '(New)/Search');" onclick="return doEmptytextbox('ctl00_MainContent_txtNcid', '(New)/Search');" Font-Bold="true"></asp:TextBox>