i'm a newbie in ASP.NET programming and I am facing a strange situation. I have an ASP page with a table containing always different rows, dinamically loaded from a MSSQL DB. In each row of the table I have created a Button, called Details, that is dynamically created during the writing of the table. This Details button is added with the following code:
Button detailsButton = new Button(); detailsButton.Height = new Unit("18px"); detailsButton.Width = new Unit("65px"); detailsButton.Text = "Details"; detailsButton.ID = row.ItemArray.ToString(); detailsButton.PostBackUrl = "~\\DetailsPage.aspx?selectedSignalling=" + detailsButton.ID; //detailsButton.Click += detailsAgencyButton_Click; //detailsButton.OnClientClick = "return true;"; table1cell4.Controls.Add(detailsButton); table1row.Cells.Add(table1cell4);
The intention is to redirect the client towards the Postback URL when one button is pressed on a row. The Postback URL is dinamically created for each button, associating to each of them the ID of the item that the user would choose to display the details.
While this works fine on the my development environment, that is running IIS 7.5, this is not always working on the production environment, that runs IIS 6.0 and that cannot be updated. On IIS 6.0, some clients does not notice any problem, while others are not able to display the details page, but, when clicking on the Details button, the postback URL is not loaded and instead there is only the reload of the current page. I have tried to change many settings (set the detailsButton.Click, set the OnClientClick to "return true;"), but without luck. I have only noticed that adding the: detailsButton.OnClientClick = "return true;"; instruction, the redirect does not work in IIS 7.5 too. So it seems to me that when OnClientClick returns something (true/false), the PostBack is not activated, while some of the clients probably does not return any OnClientClick and the PostBack is activated. Can someone help me with this matter? Thanks in advance and sorry for my poor english, this is the first time for me here on StackOverflow and with programming challenges.