Hi Tim,
I've mentioned that you've posted two threads on the same problem on the
datagrid's sortcommand no fire. I've replied you in the former two ones.
Also, I'll repaste my reply here:
------------------------------------------------------------------------
Hi Tim,
From the you description, you used a webform datagrid(with allowSorting as
true) and you generate some columns which need sorting at runtime into the
datagrid. However, you found that at runtime, when clicking the sorting
link, the page was posted back ,but the datagrid's sort event wasn't be
fired, yes?
As for this problem, I doubt that whether it is caused by the event handler
not being registerd correctly. Do you register the
datagrid 's sortcommand handler statically or dynamically at runtime? For
example:
this.dgFire.SortCommand += new
System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.dgFire_SortCo
mmand);
If you add the event handler at runtime ( in page init or page_load), do
you add it every time the page is loaded( not only firsttime)? If not , the
event handler will be lost when the page is posted back. In other words,
the page will still be posted back when clicking the sort link, but the
serverside's handler will never be hited.
I've attached a test page to show the behavior I mentioned above in this
message, please refer to it to see whether this is the cause of your
problem.
In addition, if the problem is caused by anything else, would you please
provide some further code on your page so that I can help to do some
further research on my side? Thanks.
----------------------------------------------------------------------------
------------------------
In addition, I think Kevin's suggestion that check the form fields
(__EVENTTARGET and __EVENTARGUMENT) is quite reasonable, besides check them
at clientside through html source, you can also check them at serverside
when using F5 debug(checking the request's form collection).
If you have anything unclear or have any further questions, please feel
free to post here or in the former thread.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx