I've some RegisterStartupScript in my C# code behind that assign some values to some fields to some controls of a panel when it is openend.
我的c#代码后面有一些RegisterStartupScript,在面板是openend的时候,它会为面板的某些控件分配一些值。
Controls in the panel show as if their values had been assigned properly but in reality they work as if the had never been assigned, I've checked this on the dinamic view of my aspx page.
面板中的控件显示它们的值似乎被正确分配了,但实际上它们的工作方式好像从来没有被分配过,我在我的aspx页面的din肟视图中检查了这个。
For example: This is an instruction of one of the startup scripts: document.getElementById("MainContent_Textbox1215").value ='CALL CENTER';, and in fact when I see that textbox on the screen it displays call center.
例如:这是一个启动脚本的指令:document.getElementById(“MainContent_Textbox1215”)。value ='CALL CENTER';事实上,当我在屏幕上看到这个文本框时,它会显示CALL CENTER。
But at the same time, this is what is really in code and what the application interprets for future operations, taken from the dinamic view of that particular page.
但与此同时,这是代码中真正的内容,以及应用程序对未来操作的解释,取自特定页面的din视图。
<input name="ctl00$MainContent$Textbox1215" type="text" id="MainContent_Textbox1215" class="listBox" style="width:50%;" />
Similar things happen with radiobuttons, so even if on screen one seems to be selected the one that's selected for real is the one defined as default, and likely with all types of controls.
类似的事情也发生在radiobuttons身上,所以即使在屏幕上有一个似乎被选中了,选择为real的那个就是默认的那个,很可能是所有类型的控件。
It's like for real a value had never been assigned to the textBox or the radiobutton... This is the weirdest thing I've ever seen in programming, hope you can guide me about what to do.
就像一个值从来没有被分配到文本框或radiobutton…这是我在编程中见过的最奇怪的事情,希望您能指导我该怎么做。
1 个解决方案
#1
1
Even i have faced such a problem once while working with javascript and dotnet.
What i can say is that you might not have specified the **Value** attribute of
the textbox in you html that is the reason it is not showing it in your dynamic
aspx page but the value has been assigned and you can use it anywhere you want.
This you can verify even with ha plain html page there also i faced the same
thing. But if you have specified some value for the Value attribute you will see
old value in the html source but if you try to access it using javascript it will
show you the new value. I cant figure out the reason behind this behaviour but
this is what i have experienced.
#1
1
Even i have faced such a problem once while working with javascript and dotnet.
What i can say is that you might not have specified the **Value** attribute of
the textbox in you html that is the reason it is not showing it in your dynamic
aspx page but the value has been assigned and you can use it anywhere you want.
This you can verify even with ha plain html page there also i faced the same
thing. But if you have specified some value for the Value attribute you will see
old value in the html source but if you try to access it using javascript it will
show you the new value. I cant figure out the reason behind this behaviour but
this is what i have experienced.