Double Postback
ASP.NET 2.0 ile geliştirdiğimiz bir uygulamada enteresan bir bug'a rastladım.
GridView içerisinde ki CommandFiled'lar sağlıklı bir şekilde çalışıyorken. ButtonType özelliğini Image yaptığımızda postback işlemi iki kere gerçekleşiyor.
<
asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name"/>
<asp:CommandField ShowDeleteButton="True" ButtonType="Image" DeleteImageUrl="~/Images/Icons/Delete.png" />
</Columns>
</asp:GridView>
Uzunca bir süre kodumu inceledim nerede hata yaptım diye. "double postback" anahtar kelimeleri ile yaptığım bir araştırma sonucunda bunu bir bug olduğunu gördüm : http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=156012
Microsoft yetkilileri "We are investigating this issue" desede Bug'ı bildiren WebGolem hayli ilginç bir çözüm sunmuş :
http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=156012
Entered by WebGolem on 7/4/2006
insert the following lines in your RowCommand event:
if
(Request["x"] == null || Request["y"] == null)
{
Response.End();
}