में एक छिपी हुई फ़ील्ड में एक मान सेट करना मुझे एएसपी.NET 4.5 में एक छिपी हुई फ़ील्ड में मूल्य निर्धारित करने में कुछ समस्याएं हैं।एएसपी.NET 4.5
ASPX में:
<asp:HiddenField ID="HiddenField" runat="server" value="" />
<script type="text/javascript">
function SetHiddenField() {
var vv = "HELLO WORLD";
document.getElementById('<%=HiddenField.ClientID%>').value = vv;
}
</script>
में कोड-पीछे:
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "SetHiddenField", "SetHiddenField();", true);
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", "alert('" + HiddenField.ClientID + "');", true);
इस में कचरा अलर्ट
मैं क्या देखा है मैं किसी भी भाग्य के बिना निम्नलिखित की कोशिश की है सेक्लाइंट आईडी
मैंने जो अन्य समाधान किया है वह निम्नलिखित है।
.aspx में:
<asp:HiddenField ID="HiddenField" runat="server" value="" />
<script type="text/javascript">
function SetHiddenField() {
var vv = "HELLO WORLD";
document.getElementById('HiddenField').value = vv;
}
</script>
यहां मुद्दा यह है कि .value
IntelliSense, केवल .ValueOf
में मौजूद नहीं है है।
कोड-पीछे में:
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "SetHiddenField", "SetHiddenField();", true);
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", "alert('" + HiddenField.Value + "');", true);
कुछ भी नहीं है के बाद से कोई चेतावनी दिखाया गया है, होता है शायद जावास्क्रिप्ट में एक त्रुटि,।
क्या कोई मुझे सही दिशा में इंगित कर सकता है, कृपया?
अपने दूसरे उदाहरण में अपने छिपे हुए क्षेत्र पर 'ClientIDMode = "स्टेटिक" ' –