protected void btnSubmit_Click(object sender, EventArgs e) { try { if (ddlEmailID.SelectedValue == "--Select--") { lblMsg.Visible = true; lblMsg.Text = "Please Select Email ID"; } else { lblMsg.Visible = false; if (txtToDate.Text == "") { txtToDate.Text = txtFromDate.Text; } DataSet ds = marclass.GetLogsList(ddlEmailID.SelectedValue, txtFromDate.Text, txtToDate.Text); if (ds.Tables[0].Rows.Count > 0) { gvReports.DataSource = ds.Tables[0]; gvReports.DataBind(); } else { lblMsg.Visible = true; lblMsg.Text = "No Data to Display"; } } } catch (Exception ex) { lblMsg.Visible = true; lblMsg.Text = "No Data to Display"; } }