/// <summary>
/// 轉頁
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void txt_TextChanged(object sender, EventArgs e)
{
int temp;
if (int.TryParse(((TextBox)sender).Text, out temp))
{
CurrentPage = temp < 1 ? 1 : temp;
}
else
{
return;
}
}
/// <summary>
/// 匯出excel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void btn_Click(object sender, EventArgs e)
{
if (!SelectCommand.IsEmpty() && !OrderBy.IsEmpty())
{
this.DataBindForExcel();
}
else
{
if (ShowRecordCount)
{
this.Controls[0].FindControl("trQueryResultExcel").Visible = false;
}
if (ShowExportExcelButton || TotalPage > 1)
{
Table t = this.Controls[0] as Table;
t.Rows.RemoveAt(t.Rows.Count - 1);
}
}
if (!ExportExcelHiddenColIndex.IsEmpty())
{
foreach (string ind in ExportExcelHiddenColIndex.Split(','))
{
this.Columns[Convert.ToInt16(ind)].Visible = false;
}
}
if (!ExportExcelClearControlIndex.IsEmpty())
{
RenderDataToText();
}
Coeno.ExcelUtility.ContorlToExcel.ToExcel(this);
}
/// <summary>
/// 分頁button click事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected virtual void lbtn_Click(object sender, EventArgs e)
{
if (((LinkButton)sender).CommandArgument != "-1")
{
CurrentPage = Convert.ToInt32(((LinkButton)sender).CommandArgument);
}
SetDataSource(false);
DataBind();
}