在起始页中:当客户端单击 LinkButton 时,我想将目录路径传递给弹出窗口页面lbtnEditText
<asp:LinkButton ID="lbtnEditText" runat="server" Text="Edit Text" CommandArgument='<%# Eval("Path") + "," + Eval("Name")%>' OnCommand="Button1_Click"></asp:LinkButton>
以及背后的代码:
protected void Button1_Click(object sender, CommandEventArgs e)
{
string[] values = e.CommandArgument.ToString().Split(',');
string queryString =
"editpage.aspx?path="
+ values[0];
string newWin =
"window.open('" + queryString + "');";
ClientScript.RegisterStartupScript
(this.GetType(), "pop", newWin, true);
}
queryString
确切地说是= "editpage.aspx?path=D:\\C#Projects\\website\\Lecturer\\giangvien\\profile.xml"
(我在调试时检查它)
但在目标页面(弹出窗口):editpage.aspx
string path = Request.QueryString["path"];
string content = File.ReadAllText(path);
if(content!=null)
textarea.Value = content;
它有一个错误:Could not find file 'D:\C#Projects\website\C
尝试调试,path
我收到的只是:"D:C"
并在editpage.aspx
显示的地址栏中:
http://localhost:41148/website/editpage.aspx?path=D:C#ProjectswebsiteLecturergiangvienprofile.xml
帮助!!!为什么当我将它传递给editpage时路径会改变???