Use CommandField column to postback on GridView

I 've created GridView with HyperlLinkField columns. But I wanted to have link click to postback to the same page.
 
I looked at some solutions like in a thread:GridView HyperLinkField with call to a javascript function
It seems not working, I have a link as :
<asp:HyperLinkField DataTextField="Field1" HeaderText="ID"
SortExpression="Field1"
NavigateUrl="javascript:returnData('{0}','{1}');"
datanavigateurlfields="Field1,Field2" target="_top"/>
One of possible  approaches described in Steps to Write GridView PostBack Events
However I choose suggestion to use System.Web.UI.WebControls..::.ButtonField or        System.Web.UI.WebControls..::.CommandField.
In particular I an using CommandField instead of hyperlinkfield.
hyperlinkfield is good for external links.
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted @ Wednesday, April 09, 2008 1:45 AM
Print

Comments on this entry:

No comments posted yet.

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«February»
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
26272829123
45678910