请问如何在脚本中获得后台的返回的字符串
<asp:BoundColumn HeaderText='<%=GetColumnTitle("Lot")%>'DataField="Lot"></asp:BoundColumn>
GetColumnTitle是后台的一个函数,返回字符串然后赋值给headertext属性。boundcolumn是在templatecolumn中动态生成的。
下面是这个函数
If Title = "Lot" Then
GetColumnTitle = "lot"
End If If Title = "Gross" Then
GetColumnTitle = "lot"
End If If Title = "Net" Then
GetColumnTitle = "lot"
End If If Title = "Tax" Then
GetColumnTitle = "lot"
Else
GetColumnTitle = "None"
End If
为什么这个函数在脚本里得不到任何返回的字符串。
<asp:BoundColumn HeaderText='<%=GetColumnTitle("Lot")%>'DataField="Lot"></asp:BoundColumn>
GetColumnTitle是后台的一个函数,返回字符串然后赋值给headertext属性。boundcolumn是在templatecolumn中动态生成的。
下面是这个函数
If Title = "Lot" Then
GetColumnTitle = "lot"
End If If Title = "Gross" Then
GetColumnTitle = "lot"
End If If Title = "Net" Then
GetColumnTitle = "lot"
End If If Title = "Tax" Then
GetColumnTitle = "lot"
Else
GetColumnTitle = "None"
End If
为什么这个函数在脚本里得不到任何返回的字符串。
解决方案 »
- java正则表达式取得html标签内的内容
- Jquery ajax 调用webservice问题
- 怎么做只要有收件人邮箱,而不用发件人邮箱,直接发送邮件?
- asp.net动态更新Label.TEXT值
- 获取日历控件的SelectDate
- asp.net网站如何生成静态页网站
- 讨论: 如何实现在ASP.NET下对访问者活动虚拟实时跟踪
- 如何将二进制转化成十六进制
- 为什么我翻页到下个10页,点击任一页都会跳回到第一个10页阿?
- 请icyer及各位帮帮忙,看看,小女子实在感激不尽,谢谢 !!!!!
- Page_Load事件只执行一次,求解....
- 关于将DATAGRID中的数据导出到EXCEL时出现的问题!
{
If Title = "Lot" Then
return "lot"
End If If Title = "Gross" Then
return = "lot"
End If
...
}<asp:BoundColumn HeaderText='<%# GetColumnTitle("Lot") %>' DataField="Lot"></asp:BoundColumn>
改成
<%# GetColumnTitle("Lot")%>
另外GetColumnTitle()要用protected或public定义,不要用private
<asp:BoundColumn HeaderText='<%# GetColumnTitle(DataBinder.Eval(Container.DataItem,"Lot")) %>' DataField="Lot"></asp:BoundColumn>后台:
Protected Function GetColumnTitle(ByVal Title As String) As String
If Title = "Lot" Then
GetColumnTitle = "lot"
End If If Title = "Gross" Then
GetColumnTitle = "lot"
End If If Title = "Net" Then
GetColumnTitle = "lot"
End If If Title = "Tax" Then
GetColumnTitle = "lot"
Else
GetColumnTitle = "None"
End If
End Function
Compiler Error Message: BC30676: 'DataBinding' is not an event of 'System.Web.UI.WebControls.BoundColumn'.
你最好在生成BoundColumn时,就把数据直接写上去.
方法要是public的
在datagrid的dataitembound事件中,调用你后端的函数,更改headertext属性。