[C#][2.0] Pourquoi mon code ne passe pas avec IE ?
Bonjour,
J'ai un problème avec IE uniquement. Avec Firefox mon code marche bien, sans erreurs.
Code:
1 2 3 4 5 6 7 8
|
<%= writeScripts() %>
<a href="#" onclick="viewContact('param1', 'param2')">un lien</a>
<asp:Button ID="viewContactButton" runat="server" OnClick="viewContactButton_Click" Text="view contact" />
<asp:Textbox ID="contactClicked" runat="server" Text="" />
<asp:Textbox ID="contactTypeClicked" runat="server" Text="" /> |
Code behind :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
public string writeScripts()
{
string script = "<script type=\"text/javascript\">\n" +
"function viewContact(id, type) {\n" +
"var objText = document.getElementById('" + contactClicked.ClientID + "');\n" +
"objText.value = id;\n" +
"var objTextType = document.getElementById('" + contactTypeClicked.ClientID + "');\n" +
"objTextType.value = type;\n" +
"var objButton = document.getElementById('" + viewContactButton.ClientID + "');\n" +
"objButton.click();\n" +
"}\n" +
"</script>\n";
return script;
}
public void viewContactButton_Click(object sender, EventArgs e)
{
} |
Avec IE, lorsque j'appuie sur le lien, mes textBox sont bien remplies avec param1 et param2 cependant lors de la simulation du click j'ai une erreur javascript : null is null or not an object...
Le pire c'est que ma méthode viewContactButton_Click est bien exécutée mais le code a l'interieur ne semble pas pris en compte puis qu'il ne change rien.
Pouvez vous m'aider ?
Eome