checkboxlist的简单问题
做了一个题库系统,想让选中的题目输出为word,Submit1是“生成试卷”按钮,不知道为什么输出的word是空白的protected void Submit1_ServerClick(object sender, EventArgs e)
{
string myString = "";
for (int i = 0; i < CheckBoxList1 .Items .Count ; i++)
{
if (CheckBoxList1 .Items [i].Selected ==true )
{
myString = myString + Request.Form.Get("CheckBoxList1.Items[i]") + "@";
}
}
string numsingle = "";
for (int i = 0; i < myString.Length; i++)
{
if (!myString.Substring(i, 1).Equals("@"))
{
numsingle = numsingle + myString.Substring(i, 1);
}
else
{
numsingle = numsingle + "\n";
}
}
OutPut("attachment;filename=peper.doc", "application/ms-word", numsingle);
}
private void OutPut(string fileType, string strType, String text)
{
Response.Clear();
Response.Buffer = true;
Response.Charset = "GB2312";
Response.AppendHeader("Content-Disposition", fileType);
Response.ContentType = strType;
this.EnableViewState = false;
Response.Write(text);
Response.End();
}
--------------------编程问答-------------------- 帮顶!!! --------------------编程问答-------------------- myString = myString + Request.Form.Get("CheckBoxList1.Items[i]") + "@";
将红色双引号删除掉 --------------------编程问答-------------------- myString = myString + Request.Form.Get("CheckBoxList1.Items[i]") + "@";
将红色双引号删除掉
补充:.NET技术 , ASP.NET