Tuesday, March 17, 2015

what is the benefit of bundling in asp.net mvc

Bundling and Minification is more useful in production than in development. It can significantly improve your first page hit download time.
  • Bundling reduces the number of individual HTTP requests to server by combining multiple CSS files and Javascript files into single CSS file and javascript file.
  • Minification reduces the file download size of CSS and javascript files by removing whitespace, comments and other unnecessary characters.
Such small advantages are more pronounced in a production environment than in development. So it is better to go with Bundling and Minification in production.
Specific to your question there is no palpable benefit in bundling/minification during runtime. This feature is there just to make the developer's work easier. So it is even better to go with manually bundled/minified assets in production if you are sure about what you are doing.
Update: According to MSDN there is a real benefit in bundling/minification during runtime
Bundling and minification in ASP.NET 4.5 is performed at runtime, so that the process can identify the user agent (for example IE, Mozilla, etc.), and thus, improve the compression by targeting the user browser (for instance, removing stuff that is Mozilla specific when the request comes from IE).`
The power of dynamic bundling is that you can include static JavaScript, as well as other files in languages that compiles into JavaScript.`
For example, CoffeeScript is a programming language that compiles into JavaScript

Monday, February 16, 2015

RDLC report using xsd in c# with drill down report



using Microsoft.Reporting.WebForms;
using ImprisonmentTypeTableAdapters;
protected void Page_Load(object sender, EventArgs e)
    {
     
        String userAgent = Request.ServerVariables.Get("HTTP_USER_AGENT");
        if (userAgent.Contains("MSIE 7.0"))
        {
            ReportViewer1.Style.Add("margin-bottom", "30px");
        }
    }

protected void btnReport_Click(object sender, EventArgs e)
    {
        ViewState["level"] = 0;
        getReportData();
    }
    private void getReportData()
    {

        int JailCode = Convert.ToInt32(ddlJail.SelectedValue);
        int DistCode = Convert.ToInt32(ddlDistName.SelectedValue);
        Report_ImprisonmentTimeTableAdapter ta = new Report_ImprisonmentTimeTableAdapter();
        ImprisonmentType.Report_ImprisonmentTimeDataTable dt = new ImprisonmentType.Report_ImprisonmentTimeDataTable();

        try
        {
            ta.Fill(dt, Convert.ToInt32(ddlYear.SelectedValue), Convert.ToInt32(ddlMonth.SelectedValue), Convert.ToInt32(ddlDay.SelectedValue), JailCode,DistCode);
        }
        catch
        {
            DataRow[] dr = null;
            dr = dt.GetErrors();
        }
        ReportViewer1.Visible = true;
        ReportDataSource rds = new ReportDataSource();
        ReportViewer1.Reset();
        ReportViewer1.ProcessingMode = ProcessingMode.Local;
        LocalReport rep = ReportViewer1.LocalReport;
        rep.Refresh();
        rep.ReportPath = "RDLCReport/rdlc/State_Prisoner_ImprisonmentTime.rdlc";



        rds.Name = "ImprisonmentType_Report_ImprisonmentTime";
        rds.Value = dt;
        rep.DataSources.Add(rds);


        ReportParameter[] parms = new ReportParameter[4];
        parms[0] = new ReportParameter("Year", ddlYear.SelectedValue, true);
        parms[1] = new ReportParameter("Month", ddlMonth.SelectedValue, true);
        parms[2] = new ReportParameter("Day", ddlDay.SelectedValue, true);
        parms[3] = new ReportParameter("JailName", ddlJail.SelectedItem.Text, true);
        this.ReportViewer1.LocalReport.SetParameters(parms);
        rep.Refresh();
    }


    protected void DemoDrillthroughEventHandler(object sender, DrillthroughEventArgs e)
    {
        try
        {
            if (ViewState["level"] != null)
            {
                int level = Convert.ToInt32(ViewState["level"]);
                ViewState["level"] = ++level;
                btnBack.Visible = true;
            }
            LocalReport localreport = (LocalReport)e.Report;
            ReportViewer1.Visible = true;
            ReportViewer1.Reset();
            ReportViewer1.ProcessingMode = ProcessingMode.Local;
            localreport.Refresh();
            ReportParameterInfoCollection DrillThroughValues = e.Report.GetParameters();
            string Year = DrillThroughValues["Year"].Values[0];
            string Month = DrillThroughValues["Month"].Values[0];
            string Day = DrillThroughValues["Day"].Values[0];
            string JailCode = DrillThroughValues["JailCode"].Values[0];

            Report_ImprisonmentTime_DrillTableAdapter ta = new Report_ImprisonmentTime_DrillTableAdapter();
            ImprisonmentType.Report_ImprisonmentTime_DrillDataTable dt = new ImprisonmentType.Report_ImprisonmentTime_DrillDataTable();
            try
            {
                ta.Fill(dt, Convert.ToInt32(Year), Convert.ToInt32(Month), Convert.ToInt32(Day), int.Parse(JailCode));
            }
            catch
            {
                DataRow[] dr = null;
                dr = dt.GetErrors();
            }
            ReportDataSource level1datasource = new ReportDataSource();
            localreport.ReportPath = "RDLCReport/rdlc/State_Prisoner_ImprisonmentTime_Drill.rdlc";
            level1datasource = new ReportDataSource("ImprisonmentType_Report_ImprisonmentTime_Drill", dt);
            localreport.DataSources.Clear();
            localreport.DataSources.Add(level1datasource);
            localreport.Refresh();
        }
        catch (Exception ex)
        {
        }
    }
    protected void btnBack_Click(object sender, EventArgs e)
    {
        if (ViewState["level"] != null)
        {
            int level = Convert.ToInt32(ViewState["level"]);
            if (level == 1)
            {
                getReportData();
                btnBack.Visible = false;
            }
            ViewState["level"] = --level;
        }
    }

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>


                    ShowPrintButton="true" Visible="false" ZoomMode="Percent" OnDrillthrough="DemoDrillthroughEventHandler" >
               





ASP.NET Core

 Certainly! Here are 10 advanced .NET Core interview questions covering various topics: 1. **ASP.NET Core Middleware Pipeline**: Explain the...