导航URL,超链接按钮

时间:2011-12-02 17:49:53

标签: c# asp.net file-upload hyperlink

我正在尝试在导航网址中传递两个参数,以便在我的downloads.aspx文件中请求它们。

我总是收到这个错误...

Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

这是我的代码:

HL.NavigateUrl = String.Format("downloading.aspx?path={0}&file={1}" + GetTheCurrentDirectory(selectedNodeValue) + fri.Name);

我不知道为什么会收到这个错误......有人能帮助我吗?

非常感谢你。

1 个答案:

答案 0 :(得分:3)

请改为:

HL.NavigateUrl = String.Format("downloading.aspx?path={0}&file={1}", GetTheCurrentDirectory(selectedNodeValue), fri.Name);

String.Format的参数应该是方法调用的单独参数,或者完全删除String.Format:

HL.NavigateUrl = "downloading.aspx?path={0}&file={1}" + GetTheCurrentDirectory(selectedNodeValue) + fri.Name;