110,534
社区成员
发帖
与我相关
我的任务
分享
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="save()">导出</a>
public partial class LogManager : System.Web.UI.Page
{
//定义私有上下文实例
private CSSIMPContext _Context = CSSIMPContext._CurrContext;
protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// 导出数据 world,exal,txt
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void save(object sender, EventArgs e)
{
DataTable dt = _Context.BeanManager.Action("bean_log_manager", "downLogManager") as DataTable;
string temp = "";
//把文本框输入的值赋值给fileName
string fileName = this.txtName.Text;
//导出world
if (radioWorld.Checked == true)
{
//单选按钮的类型
this.radioWorld.Text = "doc";
//把按钮的值赋值给temp变量
temp = this.radioWorld.Text;
OutPutHelper.OutputWorld(fileName + "." + temp, dt);
}
//导出excel
if (radioExcel.Checked == true)
{
this.radioExcel.Text = "xls";
temp = this.radioExcel.Text;
OutPutHelper.OutputExcel(fileName + "." + temp, dt);
}
//导出pdf
if (radioPdf.Checked == true)
{
this.radioPdf.Text = "pdf";
temp = this.radioPdf.Text;
OutPutHelper.OutputPdf(fileName + "." + temp, dt);
}
//导出文本
if (radioTxt.Checked == true)
{
this.radioTxt.Text = "txt";
temp = this.radioTxt.Text;
OutPutHelper.OutputTxt(fileName + "." + temp, dt);
}
}
<asp:LinkButton ID="LinkButton2" runat="server" class="easyui-linkbutton" Style="width: 70px; height: 21px" OnClick="save">导出</asp:LinkButton>
谢谢啦~~