Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

2010年10月29日 星期五

CommandArgument

下列範例示範如何使用 CommandArgument 屬性,使命令引數與 ImageButton 控制項產生關聯






Sub ImageButton_Command(sender As Object, e As CommandEventArgs)
If (e.CommandName = "Sort") And (e.CommandArgument = "Ascending") Then
Label1.Text = "You clicked the Sort Ascending Button"
Else
Label1.Text = "You clicked the Sort Descending Button"
End If
End Sub



-----------------------------------------------


<asp:imagebutton alternatetext="Sort Ascending" commandargument="Ascending" commandname="Sort" id="imagebutton1" imageurl="images/pict.jpg" oncommand="ImageButton_Command" runat="server"/>

<asp:imagebutton alternatetext="Sort Descending" commandargument="Descending" commandname="Sort" id="imagebutton2" imageurl="images/pict2.jpg" oncommand="ImageButton_Command" runat="server"/>

沒有留言:

張貼留言