郑国聪的程序员之路

html标签和asp.net在GridView里面绑定js的区别

html标签里面绑定方法:

<img src="<%=ImageURLBase%>/Attendance/btn_find.gif" width="20" border="0" style="cursor: hand;"
                        id="imgGetWTP" onclick="javascript:return GetWTP(<%# (Container.DataItemIndex).ToString() %>);" />

asp.net控件绑定方法:

<asp:TextBox ID="lblWTPID" runat="server" Width="100px"  onblur='<%# "Javascript:DeleteShift("+ Container.DataItemIndex.ToString()+")"%>' Text='<%# DataBinder.Eval(Container.DataItem, "WorkingTimePeriodID") %>'>

 

区别就在于<%# %> 的 位置。

 

 

PS:有谁告诉我为什么绑定方法为什么不同吗?

posted on 2010-04-29 14:52  郑国聪  阅读(438)  评论(0)    收藏  举报

导航