我的asp.net程序出了问题。我试图从剪贴板中读取文本,它与此代码完美配合:
protected void btn_import_Click(object sender, EventArgs e)
{
string ClipboardText = System.Windows.Forms.Clipboard.GetText();
ClipboardText = ClipboardText.Replace("\r\n", " ");
string[] ImportText = ClipboardText.Split();
int RowIndex = 0;
DataTable dtTemp = new DataTable();
Gridview_To_Dataset(gv_CreateAgent, true, false, true);
foreach (string NtAccount in ImportText)
{
try
{
if (NtAccount != "")
{
int pos = NtAccount.IndexOf("_");
if (pos > 0)
{
((TextBox)gv_CreateAgent.Rows[RowIndex].FindControl("crea_NTaccount")).Text = NtAccount.Substring(0, pos).ToLower();
((DropDownList)gv_CreateAgent.Rows[RowIndex].FindControl("crea_ddlType")).SelectedItem.Text = NtAccount.Substring(pos).Trim().ToLower();
dtTemp = Gridview_To_Dataset(gv_CreateAgent, false, false, false);
ReadDirex(dtTemp, RowIndex);
RowIndex = RowIndex + 1;
}
else
{
((TextBox)gv_CreateAgent.Rows[RowIndex].FindControl("crea_NTaccount")).Text = NtAccount.Trim().ToLower();
((DropDownList)gv_CreateAgent.Rows[RowIndex].FindControl("crea_ddlType")).SelectedItem.Text = " ";
dtTemp = Gridview_To_Dataset(gv_CreateAgent, false, false, false);
ReadDirex(dtTemp, RowIndex);
RowIndex = RowIndex + 1;
}
}
}
catch (Exception)
{
this.lbl_falschernt.Visible = true;
this.lbl_falschernt.Text = "Fehler beim Einlesen : Es dürfen nur NT-Accounts eingelesen werden!";
}
}
}
在asp.net中我添加了这个:
AspCompat="true" %>
就像我说的,在我的本地电脑上,这完美无缺。但是在我的Windows Server 2008 R2上它根本不起作用。我没有收到错误但没有任何反应。
我尝试了一些像[STAThread]
之类的东西,这些东西没有任何意义,因为
AspCompat="true"
那么可能是什么问题? 我很感激任何建议!