1. First we have to define the properties which we need to accces in aspx page in User Control as below. public string FullName
{
get { return txtFullName.Text; }
set { txtFullName.Text = value; }
}
public string Mobile
{
get { return txtMobile.Text; }
set { txtMobile.Text = value; }
}
public string Phone
{
get { return txtPhone.Text; }
set { txtPhone.Text = value; }
}
public string Birthday
{
get { return txtBirthday.Text; }
set { txtBirthday.Text = value; }
}
public string CustomerID
{
get { return txt_CustomerID.Text; }
set { txt_CustomerID.Text = value; }
}
public string gvResultsProperty
{
get { return txt_CustomerID.Text; }
set { gvResults.DataSource = value;
gvResults.DataBind();
}
}
In Aspx page you can access the properties and set the values for properties.
ucSearchContact.FullName = "";
ucSearchContact.Mobile = "";
ucSearchContact.Phone = "";
ucSearchContact.Birthday = "";
ucSearchContact.CustomerID = "";
ucSearchContact.gvResultsProperty = null;
Note: ucSearchContact is the name of user control registered in design page.
Navigation
Untitled Page
!doctype>
Hi Welcome to Easyway2interview.blogspot.com
Hi Welcome to Easyway2interview.blogspot.com. You came to right place to prepare for interview.
Now you don't need search many websites for to get the best interview questions on Microsoft technology. I am trying to gather all real interview questions asked from MNC companies and put them all here. Here you can find all types of .net interview questions. All the best....
Now you don't need search many websites for to get the best interview questions on Microsoft technology. I am trying to gather all real interview questions asked from MNC companies and put them all here. Here you can find all types of .net interview questions. All the best....
Friday, November 16, 2012
Sorting datatable in asp.net with C sharp
Sorting datatable in asp.net with C sharpDataTable dtres = (DataTable)Session["datatablename"];
DataView dv = dtres.DefaultView;
dv.Sort = "fielanemae asc";
dtres = dv.ToTable();
DataView dv = dtres.DefaultView;
dv.Sort = "fielanemae asc";
dtres = dv.ToTable();
Working with Crystal Reports in Asp.net
Working with Crystal Reports in ASP.NET
--------------------------------------------------------------------------
- 1 ) Open Visual Studio .NET, open your ASP.NET project and right-click the "Solution Explorer." Click "Add" and select "Crystal Report" from the drop-down list to add a new Crystal Report to your website.
- 2 ) Tick the "As a Blank Report" radio button when the "Crystal Report Gallery" window appears and click "OK." This will open your new report file in the "Crystal Report Designer" window.
- 3 ) Right-click on "Details Section," select "Database" and click "Add/Remove Database" to add a new database in your Crystal Report.
- 4) Click the small "+" in front of the "OLE DB (ADO)" option to expand it when the "Database Expert" window pops up. A "OLE DB (ADO)" window will appear.
- 5) Click "Microsoft OLE DB Provider for SQL Server" and click "Next." Enter your connection information and click "Next." Click "Finish" and you will see the "Database Expert." Your database tables will also be visible.
- 6) Click the small "+" you see in front of the "Pubs" database, expand the "Tables" category and select the "Stores" table. Click the small ">" to include this table in your "Selected Tables" section. Note that you can add more than one table. You will see the table and its fields in the "Database Fields" section.
- 7) Locate the fields you need in your report and drag them to the "Details" section of the report. The "Page Header" section will show the field names. Save the Crystal Report and select a location on your hard disk drive. The report file will be created at that location.
Creating a Crystal Report Viewer Control
- 8) Go to Visual Studio .NET toolbox and locate the "Crystal Report Viewer." Drag it onto your ASP.NET webpage. Right-click on it and select "Properties" to open the "Properties" window for your control.
- 9) Click the small "[...]" you see after the "Data Binding" property. This will open the "Data Binding" window. Click on "Report Source."
- 10) Tick the "Custom Binding Expression" radio button you see in the resulting window. Navigate to where you saved the report file and select it. The "Crystal Report Viewer" will display a preview of the report file. Click "OK" to insert the Crystal Report Viewer controls and set its properties. Note that the data in the preview is not your real data. Real data will be fetched only when the report is run.
- 11) Open the "Code Behind" file (.aspx.vb) and call the "Databind" method on "Page Load Event." Compile and run your ASP.NET 3.5 Web page and it will display the Crystal Report using real data, fetched from your database.
--------
// Crystal report which accepts Parameters.
string CrystalReport_user = System.Web.Configuration.WebConfigurationManager.AppSettings["CrystalReport_user"];
string CrystalReport_password = System.Web.Configuration.WebConfigurationManager.AppSettings["CrystalReport_password"];
string CrystalReport_server = System.Web.Configuration.WebConfigurationManager.AppSettings["CrystalReport_server"];
string CrystalReport_database = System.Web.Configuration.
WebConfigurationManager.AppSettings["CrystalReport_database"];
CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt;
cryRpt = new ReportDocument();
Logger.Write("\n ReportPath" + AppDomain.CurrentDomain.BaseDirectory + "Lead\\Report_1.rpt");
cryRpt.Load(AppDomain.CurrentDomain.BaseDirectory + "Lead\\Report_1.rpt");
int decValue = 541;
cryRpt.SetDatabaseLogon(CrystalReport_user, CrystalReport_password, CrystalReport_server, CrystalReport_database);
cryRpt.SetParameterValue("LocationID", decValue);
cryRpt.SetParameterValue("LeadStatus", "Open");
CrystalReportViewer1.ReportSource = cryRpt;
CrystalReportViewer1.DisplayGroupTree = false;
// Basic Crystal Report
cryRpt.Load(AppDomain.CurrentDomain.BaseDirectory + "Lead\\BlankCrystalReport.rpt");
CrystalReportViewer1.ReportSource = cryRpt;
CrystalReportViewer1.DisplayGroupTree = false;
Subscribe to:
Posts (Atom)