का उपयोग कर एएसपीनेट में रिपोर्ट कैसे बनाएं I विजुअल स्टूडियो 2010 का उपयोग कर रहा हूं। मैंने इससे पहले क्रिस्टल रिपोर्टिंग पर काम किया है लेकिन अब मैं रिपोर्ट व्यूअर का उपयोग करके रिपोर्ट जेनरेट करना चाहता हूं। जैसा कि मैं इस विषय में नया हूं कृपया मुझे गाइड करें। धन्यवाद !!!रिपोर्ट व्यूअर
उत्तर
बुनियादी ट्यूटोरियल के लिए आप
Adding and Configuring the ReportViewer Controls
Creating an ASP.NET report using Visual Studio 2010 - Part 1
Creating an ASP.NET report using Visual Studio 2010 - Part 2
Creating an ASP.NET report using Visual Studio 2010 - Part 3
How to use the Report Viewer Control to access a Reporting Services Server
मेरे कोड बिजनेस क्लास वस्तुओं के लिए रिपोर्ट बनाने के लिए काम करता है ...
बिजनेस क्लास का उपयोग कर रिपोर्ट बनाना ऑब्जेक्ट्स & ReportViewer (ASP.NET/ सी #) 1. बनाएँ छात्र कक्षा
public class StudentClass
{
public int No { get; set; }
public string Name { get; set; }
public string Degree { get; set; }
}
2.Create छात्र GetStudents साथ भंडार() समारोह
public class StudentRepository : StudentClass
{
public List<StudentClass> studentList = new List<StudentClass>();
public List<StudentClass> GetStudents()
{
StudentClass student1 = new StudentClass();
student1.No = 1;
student1.Name = "Bhuvana";
student1.Degree = "M.Tech";
studentList.Add(student1);
StudentClass student2 = new StudentClass();
student2.No = 2;
student2.Name = "Annie";
student2.Degree = "B.Tech";
studentList.Add(student2);
StudentClass student3 = new StudentClass();
student3.No = 3;
student3.Name = "Muthu Abi";
student3.Degree = "B.Tech";
studentList.Add(student3);
return studentList;
}
}
3.Using रिपोर्ट विज़ार्ड "StudentReport.rdlc" बना सकते हैं और चयन डेटास्रोत
,2104.In index.aspx स्क्रिप्ट प्रबंधक और रिपोर्ट व्यूअर उपकरण बॉक्स से फ़ाइल के पीछे कोड में (खींचें और ड्रॉप)
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="ReportViewer1" runat="server">
</rsweb:ReportViewer>
</div>
5.Modify Page_Load() विधि जोड़ने
public partial class Index : System.Web.UI.Page
{
StudentRepository sr = new StudentRepository();
List<StudentClass> sc = new List<StudentClass>();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report/Student.rdlc");
sc = sr.GetStudents();
IEnumerable<StudentClass> ie;
ie = sc.AsQueryable();
ReportDataSource datasource = new ReportDataSource("DataSet1", ie);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
}
}
}
6.Build और रन
धन्यवाद प्रणय ... ये बुनियादी ट्यूटोरियल मेरी मदद कर रहे हैं ... –
@ सोनामोमोहाइट - आपका स्वागत है .. मेरे उत्तर पर अपवित्र के लिए इंतजार कर रहा है .. –
अरे प्रणय .... मेरी मदद के लिए पहला धन्यवाद । संग्रहीत प्रक्रियाओं के साथ डेटासेट बनाने के बारे में थोड़ा भ्रम है। जैसा कि मैंने टेबलसेट के साथ डेटासेट के साथ अच्छी तरह से काम किया है, इसलिए अब इसे आजमाएं। क्या आप इसके लिए कोड पोस्ट कर सकते हैं। –