2011年2月22日 星期二

GridView CommandArgument is Empty

當CommandArgument == ""的時候,可以使用下面的屬性來設定asp伺服器元件
(LinkButton , CommandButton等...)

CommandArgument='<%# Container.DataItemIndex%>'
(取出來的值是代表目前的row在整個gridview裡的index)

CommandArgument='<%# Container.DisplayIndex %>'
(取出來的值是代表目前的row顯示在gridview裡的index)

ex.
<asp:LinkButton ID="lbtnSend" runat="server" CausesValidation="False" CssClass="btnlink"
CommandName="Send" Text="發信" CommandArgument='<%# Container.DisplayIndex %>'></asp:LinkButton>

2011年2月8日 星期二

取得控制項在螢幕上的絕對位置

Point p = control.PointToScreen(new Point(0, 0));