绑定时这样写: <%#getDepth(databinder.item(Depth))%> 在后台代码中新一个公共函数: public function getDepth(sDepth) as string if sDepth="" then Response.Write("请选择深度"); end if ....'其它代码,包括返回值等. end function
为什么非要在ASPX端取直啊,一般来讲应在服务器端解决数据处理问题. 要处理多个字段也可以这样: <%#getDepth(container.dataitem("Depth"),container.dataitem("字段1"),container.dataitem("字段2"))%> ''对了,前面的回复中此处代码应为container.dataitem,而不是databinder.item,好不意思! 在后台代码中新一个公共函数: public function getDepth(sDepth,变量1,变量2) as string if sDepth="" then Response.Write("请选择深度"); end if ....'其它代码,包括返回值等. end function
加# 后提示错误: CS1040: 预处理器指令必须作为一行的第一个非空白字符出现那我想取得 “Depth”字段的值 并且赋值给变量sDepth 以便于以后的程序调用!?
//if (sDepth="")
// Response.Write("请选择深度");
//要怎么写?请各位大虾再赐教! !! 谢谢!!
<%#getDepth(databinder.item(Depth))%>
在后台代码中新一个公共函数:
public function getDepth(sDepth) as string
if sDepth="" then
Response.Write("请选择深度");
end if
....'其它代码,包括返回值等.
end function
有没有实现数据被绑定后,在*.aspx 页面上直接取得 “Depth”字段的值的方法?
要处理多个字段也可以这样:
<%#getDepth(container.dataitem("Depth"),container.dataitem("字段1"),container.dataitem("字段2"))%>
''对了,前面的回复中此处代码应为container.dataitem,而不是databinder.item,好不意思!
在后台代码中新一个公共函数:
public function getDepth(sDepth,变量1,变量2) as string
if sDepth="" then
Response.Write("请选择深度");
end if
....'其它代码,包括返回值等.
end function