在.CS中public string GetFilePath(int wordID)
{
string filePath = string.Empty; filePath = Server.UrlEncode(Convert.ToString(SqlHelper.ExecuteScalar(SqlHelper.LocalSqlServer, "select ExpertAuditFile from EditorDistributionWord where wordid=" + wordID)));
return filePath;
}//mutiExpertID 是数组 例如:134,123,221, 对应的名 张三,李四,王二,
public string GetMutiFilePath(string mutiExpertID,string mutiExpertName)
{
string[] subid = mutiExpertID.Split(',');
string[] subname = mutiExpertName.Split(',');
string _name = string.Empty;
for (int i = 0; i < subid.Length; i++)
{
if (_name != string.Empty)
{
_name += " <a href=downfile.aspx?FileName=" + Server.UrlEncode("审稿单") + "&FilePath=" + GetFilePath(Convert.ToInt32(subid[i])) + ">" + subname[i] + "</a>"; }
_name= Server.UrlEncode(_name);
}
return _name;
}.AspX <asp:TemplateField HeaderText="审稿单" SortExpression="IsState" ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<%# GetMutiFilePath(Eval("SendExpertID").ToString(), Eval("SendExpert").ToString())%>
<a href="downfile.aspx?FileName=<%# Server.UrlEncode("审稿单") %>&FilePath=<%# GetFilePath(Convert.ToInt32(Eval("ID"))) %>">下载</a>
</ItemTemplate>
</asp:TemplateField>
我这么用
<%# GetMutiFilePath(Eval("SendExpertID").ToString(), Eval("SendExpert").ToString())%>
怎么显示不了我想要的链接
{
string filePath = string.Empty; filePath = Server.UrlEncode(Convert.ToString(SqlHelper.ExecuteScalar(SqlHelper.LocalSqlServer, "select ExpertAuditFile from EditorDistributionWord where wordid=" + wordID)));
return filePath;
}//mutiExpertID 是数组 例如:134,123,221, 对应的名 张三,李四,王二,
public string GetMutiFilePath(string mutiExpertID,string mutiExpertName)
{
string[] subid = mutiExpertID.Split(',');
string[] subname = mutiExpertName.Split(',');
string _name = string.Empty;
for (int i = 0; i < subid.Length; i++)
{
if (_name != string.Empty)
{
_name += " <a href=downfile.aspx?FileName=" + Server.UrlEncode("审稿单") + "&FilePath=" + GetFilePath(Convert.ToInt32(subid[i])) + ">" + subname[i] + "</a>"; }
_name= Server.UrlEncode(_name);
}
return _name;
}.AspX <asp:TemplateField HeaderText="审稿单" SortExpression="IsState" ItemStyle-HorizontalAlign="center">
<ItemTemplate>
<%# GetMutiFilePath(Eval("SendExpertID").ToString(), Eval("SendExpert").ToString())%>
<a href="downfile.aspx?FileName=<%# Server.UrlEncode("审稿单") %>&FilePath=<%# GetFilePath(Convert.ToInt32(Eval("ID"))) %>">下载</a>
</ItemTemplate>
</asp:TemplateField>
我这么用
<%# GetMutiFilePath(Eval("SendExpertID").ToString(), Eval("SendExpert").ToString())%>
怎么显示不了我想要的链接
解决方案 »
- EXCEL数据导入,在线等......
- asp.net 如何实现 带分页功 能 的合并单元格显示呀
- 正则表达式问题
- 在线急待:一个.html的静态页面应如何实现向数据库提交数据,并刷新该页面?
- 调用问题~~ 急~!!!
- 如何创建WEB客户端的组件,实现调用客户端的动态连接库(.dll)?
- 怎么用FrontPage2003和vs.net协作开发呢?是先用FrontPage2003还是先用vs.net做网页呢?
- 求类似动网新闻的HTML编辑器
- asp.net数据缓存问题
- 利用HTML控件上传文件的问题
- excel导出身份证变样了 双击后变0了
- 关于如何在后台 Button1_Click 事件中 调用前台 javascrtipt 函数的问题
没有必要Server.UrlEncode另外,你显示出的是什么内容?
for (int i = 0; i < subid.Length; i++)
{
if (_name != string.Empty)
{你这个判断也有问题 _name开始是 string.Empty,里面的代码永远不执行了
去掉
if (_name != string.Empty)
<%#GetMutiFilePath(Convert.ToString(DataBinder.Eval(Container.DataItem, "SendExpertID")))%>
这样试试 。
{
string[] subid = mutiExpertID.Split(',');
string[] subname = mutiExpertName.Split(',');
string _name = string.Empty;
for (int i = 0; i < subid.Length; i++)
{
_name += " <a href=downfile.aspx?FileName=" + Server.UrlEncode("审稿单") + "&FilePath=" + GetFilePath(Convert.ToInt32(subid[i])) + ">" + subname[i] + "</a>";
}
return _name;
}
{
return "test";
}先使用假设的数据进行测试
不行 不显示<a href="downfile.aspx?FileName=<%# Server.UrlEncode("审稿单") %>&FilePath=<%# GetFilePath(Convert.ToInt32(Eval("ID"))) %>">下载</a>
只能显示一个
我想显示参数 专家名 并且有链接 能下载
改成这样呢?
你保证 subid[i] 都是数字??
public string GetMutiFilePath(string mutiExpertID,string mutiExpertName)
{
return "出来了吗?";
}这样调试,如果出来了内容,则说明函数的问题。再去一步一步去调试
public string GetMutiFilePath(string mutiExpertID,string mutiExpertName)
{
return mutiExpertID + "||" + mutiExpertName;
}如果出来了内容,则添加别的代码