0
文本值我分配到本地存儲,如:如何在ASP.NET PageLoad事件中獲取HTML本地存儲值?
<asp:TextBox runat="server" class="field medium" ID="TextTreatement" /><br />
localStorage.setItem("TextTreatementKey", TextTreatement);// here am textbox value assign to local Storage.
我宣佈隱藏字段,如:
<asp:HiddenField ID="hdnSelectTestID" runat="server"/
我的Java腳本,如:
<script type="text/javascript">
window.onload = function(){
document.getElementById('<%=hdnSelectTestID.ClientID %>').value = localStorage.getItem("hdntestValue"); }
protected void Page_Load(object sender, EventArgs e)
{
string val =hdnSelectTestID.Value // here am not able asign value. its coming string.empty
}
有看重它的未來,但我沒能獲得價值頁面加載事件之後???? – Muthu
您確定該值是使用JavaScript設置的嗎? –
是它的設置..我頁Init事件也是它不是分配??? – Muthu