Karatas, FERHAT
I would love to change the world, but they won't give me the source code!
Using CommandArgument and OnClientClick
5.9.2007 16:52:09 - Filed under : Asp.net
The CommandArgument can contain any string set by the programmer.

Design :
...
<asp:TemplateField HeaderText="Approve">
  <ItemTemplate>
     <asp:LinkButton OnClientClick="return confirm('Are you sure ?');" ID="LinkButton1" runat="server"
     CausesValidation="False" CommandName="Approve"
     CommandArgument='<%# Bind("ApprovalID") %>'
     Text="<img src='/Images/System/icon_select.gif' border='0' title='Approve' alt='Approve'>">
     </asp:LinkButton>
  </ItemTemplate>
</asp:TemplateField>
...

Codebehind :
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
  Literal1.Text = e.CommandArgument.ToString();
}

Keywords : CommandArgument, OnClientClick
with 0 comments

What do you think ?
Security Code 5759
Check S. Code
Name  
Email  
Home Page  
Comments