Click here to Skip to main content
15,881,872 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<br />
    I have to display the gridview by filtering data in between two dates.<br />
    When I was running this code the gridview is not displaying.<br />
    no error message.<br />
    So give me solution to find the error.<br />
<br />




C#
using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using System.Data.SqlClient;
    using System.IO;
    using iTextSharp.text;
    using iTextSharp.text.pdf;
    using iTextSharp.text.html;
    using iTextSharp.text.html.simpleparser;


   namespace WebApplication1
   {
       public partial class Reporting_Mopdule : System.Web.UI.Page
       {

           protected void Page_Load(object sender, EventArgs e)
           {

             if(!IsPostBack)
             {

               solarDataSet2TableAdapters.tbl_energy_reportTableAdapter state;
               state = new solarDataSet2TableAdapters.tbl_energy_reportTableAdapter();



               DataTable dt = new DataTable();
               dt = state.GetStateDataBy();
               DropDownList1.DataSource = dt;
               DropDownList1.DataTextField = "State";
               DropDownList1.DataValueField = "State";
               DropDownList1.DataBind();


           }

           }
           protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
           {

               solarDataSet2TableAdapters.tbl_energy_reportTableAdapter state;
               state = new solarDataSet2TableAdapters.tbl_energy_reportTableAdapter();



               DataTable dt = new DataTable();
               dt = state.GetClusterDataBy(DropDownList1.SelectedValue);
               DropDownList2.DataSource = dt;
               DropDownList2.DataTextField = "Cluster";
               DropDownList2.DataValueField = "Cluster";
               DropDownList2.DataBind();


       }


           protected void Button1_Click(object sender, EventArgs e)
           {

               DateTime dt1 = Convert.ToDateTime(TextBox1_CalendarExtender.SelectedDate);
               DateTime dt2 = Convert.ToDateTime(TextBox2_CalendarExtender.SelectedDate);

               solarDataSet2TableAdapters.tbl_energy_reportTableAdapter state;
               state = new solarDataSet2TableAdapters.tbl_energy_reportTableAdapter();

               DataTable dt = new DataTable();


               dt = state.GetGridDataBy(DropDownList1.SelectedValue.ToString(), dt1.ToString(), dt2.ToString(), DropDownList2.SelectedValue.ToString());
               GridView1.DataSource = dt;
               GridView1.DataBind();


           }

       }
   }
Posted
Updated 27-Aug-14 23:36pm
v7
Comments
StM0n 28-Aug-14 3:21am    
Erh... what is your question?!

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900