datagrid里的column里,能不能显示像<%#container.dataitem("order_date")%>-<%#container.dataitem("item_id")%>
<asp:HyperLink runat= "server " ID= "item_id " Text= ' <%#container.dataitem( "item_id ")%> ' NavigateUrl= ' <%# String.Format( "itemdetail.aspx?item_id={0} ",Eval( "item_id "))%> '/>
现在只有一个item_id在这个字段里。类似:整型数字
我想把另一个order_date也放进去。 类似:20070102、
我希望组合成:20070102-7
怎么处理?
------解决方案-------------------- <asp:HyperLink runat= "server "
ID= "item_id "
Text= ' <%#container.dataitem( "item_id ")%> '
NavigateUrl= ' <%# String.Format( "itemdetail.aspx?item_id={0}&order_date={1} ",Eval( "item_id "),Eval( "order_date "))%> '/>
------解决方案--------------------放入一个后台方法,然后2个值都传进去,然后发挥处理结果的字段
------解决方案-------------------- <asp:HyperLink runat= "server " ID= "item_id "
NavigateUrl= ' <%# String.Format( "itemdetail.aspx?item_id={0} ",Eval( "item_id "))%> '>
<%#GetTodayDate(Container.DataItem( "order_date "))%> - <%#container.dataitem( "item_id ")%> </asp:HyperLink>
在后台自己写个函数。
Public Function GetTDate(ByVal datestr As Date) As String
Dim M As String = " "
Dim D As String = " "
M = datestr.Month
D = datestr.Day
If M > = 1 And M <= 9 Then M = "0 " & CStr(M)
If D > = 1 And D <= 9 Then D = "0 " & CStr(D)
Return datestr.Year & M & D
End Function