Hi,
I am trying to transmit incidentid that i get on crmform.objectid from aspx to codebehind in C#. I put this value in hiddenfield. On the client i had the value.
But on C# when i call hiddenfield.value, i got null. How can i resolve this problem?
Thanks for your help.
Here is some sample:
Aspx:
<script type="text/javascript">
/*****************Fonction pour recupérer les activités de l'incident***************/
function RecupererActivites() {
var incidentid;
if (window.parent.crmForm.ObjectId != null) {
incidentid = window.parent.crmForm.ObjectId;
document.getElementById("hdnIncidentId").value = incidentid;
var IncidentID = document.getElementById("hdnIncidentId").value;
// alert("identifiant de ***a : " + IncidentID);
} //end if
else {
alert("id null ou non défini");
}
} //end function
/***********************************************************************/
</script>
</head>
<body>
<form id="form1" runat="server" style="font-family: Arial; font-size: 11px; " >
<asp:ScriptManager ID="ScriptManager1" runat="server" OnAsyncPostBackError="ScriptManager1_AsyncPostBackError" />
<div>
<asp:HiddenField ID="hdnIncidentId" runat="server" Value="" />
</div>
<div>
<asp:GridView runat="server" ID="DetailsView" Style="font-family: Tahoma;" Font-Size=" 11px" />
</div>
<div style="width: 578px; height: 40px; overflow: hidden;">
<asp:PlaceHolder ID="errorHolder" runat="server" />
</div>
</form>
</body>
</html>
C# code:
protected void Page_Load(object sender, EventArgs e)
{
Response.AddHeader("pragma", "no-cache");
Response.CacheControl = "no-cache";
if (!IsPostBack)
{
try
{
crmService = GetCrmService("http://crm", "AccessDiffusion");
ScriptManager.RegisterStartupScript(this, GetType(), "alert", "RecupererActivites();", true);
Monincidentid = hdnIncidentId.Value;
l.Text = "l'id de l'incident " + Monincidentid;
errorHolder.Controls.Add(l);
// ShowDetailIncident(Monincidentid);
}
catch (System.Web.Services.Protocols.SoapException soap)
{
l.Text = soap.Detail.OuterXml;
errorHolder.Controls.Add(l);
}
}
}
THANKS