I have a start date and and end date that outputs a range of fields depending on the selected start date and end date to an ultraweb grid. I want just the outputed data to be exported to excel however when i export to excel it pulls all the records form the database and exports them. Can anyone help me with the code to just export the records displayed on the ultraweb grid. Here is my code
public
partial class Report : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
}
protected void Button1_Click(object sender, EventArgs e)
DateTime SDate = System.Convert.ToDateTime(StartDate.Value);
DateTime EDate = System.Convert.ToDateTime(EndDate.Value);
string strConn = "Data Source=188.199.38.9;Initial Catalog=MEDS;Persist Security Info=True;User ID=xxxxxxxxxx;Password=xxxxxxxxxxx";
string sql;
sql =
"SELECT * FROM dbo.vwMedsHotlineResults WHERE (CallDate BETWEEN '" + SDate.ToShortDateString() + " " + "' AND '" + " " + EDate.ToShortDateString() + "'" + ")" + "order by CallDate";
SqlDataAdapter adapter;
adapter =
new SqlDataAdapter(sql, strConn);
DataSet ds = new DataSet();
adapter.Fill(ds);
if (ds.Tables[0].Rows.Count == 0)
UltraWebGrid1.Visible =
false;
Label1.Text =
"No records found between dates selected. Try again!";
return;
else
Label1.Visible =
true;
UltraWebGrid1.DataSource = ds;
UltraWebGrid1.DataBind();
protected void LinkButton1_Click(object sender, EventArgs e)
// customize the grid for export
UltraWebGridExcelExporter1.ExcelStartRow = 4;
// trigger export
UltraWebGridExcelExporter1.DownloadName =
"report.xls";
UltraWebGridExcelExporter1.Export(UltraWebGrid1);
protected void UltraWebGridExcelExporter1_BeginExport(object sender, BeginExportEventArgs e)
protected void UltraWebGrid1_InitializeLayout(object sender, Infragistics.WebUI.UltraWebGrid.LayoutEventArgs e)
protected void UltraWebGridExcelExporter1_BeginExport1(object sender, BeginExportEventArgs e)
protected void UltraWebGridExcelExporter_BeginExport1(object sender, BeginExportEventArgs e)