Wednesday, 30 October 2019

VS2012 Crystal Report Viewer Group Tree Hide

VS2012 Crystal Report Viewer Group Tree Hide



Try to turn Off

CrystalReportViewer.ToolPanelView = ToolPanelViewType.None
Try to turn On
CrystalReportViewer.ToolPanelView = ToolPanelViewType.GroupTree

Parameter Panel not showing parameters when viewing report

Parameter Panel not showing parameters when viewing report



I have a strange issue occuring in Crystal Reports 2008. If I create a parameter report from our testing server all is well when viewing the report. The Parameter Panel displays the report parameters and the report works as it should. The issue comes up when the report has been moved to production and the Parameter Panel no longer displays any parameters. It's the exact same report, nothing has been changed within the report but yet the user cannot change the parameter values. It seems to be an environment setting within the Business Objects Central Management Console but I'm not able to confirm this. Any input would be greatly appreciated! By the way, we are using the HTML viewer.



I have got a solution

call your parameter in your select command and then set it into the report

how to give background color of a certain row of crystal report

Monday, 28 October 2019

How to download file with asp.net on buttton's onClick event?

How to download file with asp.net on buttton's onClick event?



This will help you
private void Button1_click(object sender, System.EventArgs e)
{
    Response.ContentType = "Application/pdf";
    Response.AppendHeader("Content-Disposition", "attachment; filename=help.pdf");
    Response.TransmitFile(Server.MapPath("~/doc/help.pdf"));
    Response.End();
}

Friday, 25 October 2019

Lazy loading in asp

Set Height and Width to any Images in asp

Set Height and Width to any Images in asp

        string filename1 = "", filename2 = "";
        string str1, str2;

if (FilePhoto1.HasFile)
            {
                string extension = Path.GetExtension(FilePhoto1.FileName);
                Stream strm = FilePhoto1.PostedFile.InputStream;
                using (var image = System.Drawing.Image.FromStream(strm))
                {
                    String Size = image.Size.ToString();
                    int newWidth = 200; // New Width of Image in Pixel 
                    int newHeight = 200; // New Height of Image in Pixel 
                    var thumbImg = new Bitmap(newWidth, newHeight);
                    var thumbGraph = Graphics.FromImage(thumbImg);
                    thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
                    thumbGraph.SmoothingMode = SmoothingMode.HighQuality;
                    thumbGraph.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    var imgRectangle = new Rectangle(0, 0, newWidth, newHeight);
                    thumbGraph.DrawImage(image, imgRectangle);
                    filename1 = Path.GetFileName(FilePhoto1.FileName);
                    Random rd = new Random();
                    int s = rd.Next();
                    str2 = s + FilePhoto1.PostedFile.FileName;

                    string targetPath = Server.MapPath("~/FolderName/") + str2;
                    thumbImg.Save(targetPath, image.RawFormat);
                    // FilePhoto1.PostedFile.SaveAs(Server.MapPath("~/FolderName/" + thumbImg));

                  //  cmd.Parameters.AddWithValue("@Photo1", str2);
                }
            }
           

Conversion failed when converting the varchar value to data type int [closed]

Conversion failed when converting the varchar value to data type int [closed]



If you are getting  error than you have to so simply this


 public void dropExhibition(DropDownList Drop, string exid)
    {
        string value = "";
        SqlCommand cmd2 = new SqlCommand("Select * from Exhibition_Master where Exhibition_Status='Open'", con);
        SqlDataAdapter sda = new SqlDataAdapter(cmd2);
        DataTable dt = new DataTable();
        sda.Fill(dt);
        foreach (DataRow dr in dt.Rows)
        {
            string s=dr["Team_Code"].ToString();
            string ex = dr["Exid"].ToString();
            string [] a = s.Split(',');
            foreach (var num in a)
            {
                if (num == exid)
                {
                    value +=ex +",";
                }
            }
        }


        cmd = new SqlCommand("select Distinct Exhibition_Name,Exid from dbo.Exhibition_Master where Exid IN(" + value.Trim(',') + ") and Exhibition_Status=@Exhibition_Status", con);
        cmd.Parameters.AddWithValue("@Exhibition_Status", "Open");


        try
        {
            con.Open();
            Drop.AppendDataBoundItems = true;
            Drop.DataSource = cmd.ExecuteReader();
            Drop.DataTextField = "Exhibition_Name";
            Drop.DataValueField = "Exid";
            Drop.DataBind();
        }
        catch (SqlException)
        {

        }
        finally
        {
            con.Close();
        }
}



Thursday, 24 October 2019

If else in Crystal Report



If else in Crystal Report


IF {SalesInvoice;1.Product_Total}>Condition Then {SalesInvoice;1.qty}
else {SalesInvoice;1.qty2}

Equivalent of "Like" operator in C#

Equivalent of "Like" operator in C#


USE THIS

if (lbl.Text.StartWith("hr")) {


}

Wednesday, 23 October 2019

Bind list in DropDown in asp



Bind list in DropDown in asp


public void BindLoaction2(DropDownList Drop)
    {
        cmd = new SqlCommand("select Location_Name,LID from dbo.Location_Master", con);
       
        try
        {
            con.Open();
            Drop.AppendDataBoundItems = true;
            Drop.DataSource = cmd.ExecuteReader();
            Drop.DataTextField = "Location_Name";
            Drop.DataValueField = "LID";
            Drop.DataBind();
        }
        catch (SqlException)
        {

        }
        finally
        {
            con.Close();
        }
    }

Monday, 21 October 2019

Displaying multiple Reports in a single report viewer Ask

Displaying multiple Reports in a single report viewer


Having reviewed the micrososft documentation, it seems you can not bind multiple reports to a viewer. As suggested here:
"Displaying a report using the CrystalReportViewer control The CrystalReportViewer control displays only one report at a time. Which report is displayed by the control is determined by which report you bind to your code. To tell the control which report to display, you bind the ReportSource property of the control to a particular report. At runtime, the control loads the report that is bound to the ReportSource property and displays it. "
The diocumentation goes on to say you can only bind a report type to the report source.
So, basically you need to build the multi view yourself. In my mind this can be done in two ways.
  • Create a report viewer for each report (maybe using a tab control)
  • Create a single viewer and display different reports based on what the user selects in your application. i.e.
I have done something simular in the past, but rather than using the report viewer, i used crystal to export the report to pdf and displayed those to the user.
I hope this is clearer. :-)

Print directly from web server to client

Print directly from web server to client



My suggestion Don't Do this first show the report in pdf or in crystal report viewer than decide to him the format is proper or not if not than he will set otherwise if you print directly than he can't see in which format data is printing and that's not good because the data structure can't be set for multiple people if you'r software will be subscription modal. 

Accessing a network printer using a web interface

Accessing a network printer using a web interface


Printers that have a direct network connection often include a built-in web server that lets you manage the printer from any browser on the network. For example, the following illustration shows the home page for a Xerox Phaser 6125 printer. This web interface lets you view status information about the printer and check the printer’s configuration. You can even view error logs to find out how often the printer jams.

To call up a printer’s web interface, enter its IP address or host name in the address bar of any web browser.
In addition to simply displaying information about the printer, you can also adjust the printer’s configuration from a web browser. For example, the following illustration shows the Network Settings page for the Xerox printer. Here, you can change the network configuration details, such as the TCP/IP host name, IP address, subnet mask, domain name, and so on.
Other configuration pages allow you to tell the printer to send an e-mail notification to an address that you specify whenever you encounter a problem with the printer.
image3.jpg
As the network administrator, you may need to visit the printer’s web page frequently, in fact you should add it to your browser’s Favorites menu so that you can get to it easily. If you have several printers, add them under a folder named Network Printers.

Print on client server


Print on client server


Before you configure a network printer to work with network clients, read the client configuration section of the manual that came with the printer. Many printers come with special software that provides more advanced printing and networking features than the standard features provided by Windows. If so, you may want to install the printer manufacturer’s software on your client computers rather than use the standard Windows network printer support.

Print server

Print server

From Wikipedia, the free encyclopedia
Jump to navigationJump to search
print server, or printer server, is a device that connects printers to client computers over a network.[1] It accepts print jobs from the computers and sends the jobs to the appropriate printers, queuing the jobs locally to accommodate the fact that work may arrive more quickly than the printer can actually handle. Ancillary functions include the ability to inspect the queue of jobs to be processed, the ability to reorder or delete waiting print jobs, or the ability to do various kinds of accounting (such as counting pages, which may involve reading data generated by the printer(s)). Print servers may be used to enforce administration policies, such as color printing quotas, user/department authentication, or watermarking printed documents.
Print servers may support a variety of industry-standard or proprietary printing protocols including Internet Printing ProtocolLine Printer Daemon protocolNetWareNetBIOS/NetBEUI, or JetDirect.
A print server may be a networked computer with one or more shared printers. Alternatively a print server may be a dedicated device on the network, with connections to the LAN and one or more printers. Dedicated server appliances tend to be fairly simple in both configuration and features. Print server functionality may be integrated with other devices such as a wireless router, a firewall, or both. A printer may have a built-in print server.
All printers with the right type of connector are compatible with all print servers; manufacturers of servers make available lists of compatible printers because a server may not implement all the communications functionality of a printer (e.g. low ink signal).

Printing a pdf file on client side printer in asp.net C#?

Printing a pdf file on client side printer in asp.net C#?


using System.Diagnostics;


Process printjob = new Process();

    printjob.StartInfo.FileName = @"D:\R&D\Changes to be made.pdf" //path of your file;

    printjob.StartInfo.Verb = "Print";

    printjob.StartInfo.CreateNoWindow = true;

    printjob.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

    PrinterSettings setting = new PrinterSettings();

    setting.DefaultPageSettings.Landscape = true;

    printjob.Start();

Saturday, 19 October 2019

HOW TO GET IPAddress in asp.net


HOW TO GET IPAddress

string IPAddress = "";

protected void Page_Load(object sender, EventArgs e)
    {
     
            IPAddress = GetIPAddress();
            Label1.Text = IPAddress;//Asp Label
  }

public string GetIPAddress()
    {
        IPHostEntry Host = default(IPHostEntry);
        string Hostname = null;
        Hostname = System.Environment.MachineName;
        Host = Dns.GetHostEntry(Hostname);
        foreach (IPAddress IP in Host.AddressList)
        {
            if (IP.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
            {
                IPAddress = Convert.ToString(IP);
            }
        }
       
        return IPAddress;
       
    }

PrintReport in asp.net

public void PrintReport(string printerIP, string printerName)
        {
            string printerFullName = CheckPrinterConfiguration(printerIP, printerName);

            if (!string.IsNullOrEmpty(printerFullName))
            {
                //create Report Document
                ReportDocument report = new ReportDocument();

                //get report path
                string reportFilePath = Path.Combine(Environment.CurrentDirectory,
                                        "Reports\\" + rptParam.ReportParameter.ReportName + ".rpt");
                report.Load(reportFilePath);

                //set datasource to report
                report.SetDataSource(data);

                //set Printer name to report
                report.PrintOptions.PrinterName = printerName;

                System.Drawing.Printing.PageSettings page = new System.Drawing.Printing.PageSettings();

                try
                {
                    //print the report
                    report.PrintToPrinter(1, true, 0, 0);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                Console.WriteLine("Printer is not configured with IP: {0}
                and Name: {1}", printerIP, printerName);
            }
        }