処理中に ASP.NET ページのコントロールを無効にしようとしています。この目的のために、私はhereのソリューションを採用し、DOM ツリーを実行して、すべての子コントロールを無効にしました。これは、無効にしようとしている画面の多くの部分でうまく機能しますが、コントロールがいっぱいのテーブルを無効にしようとすると、次のエラーが発生します:-
Server Error in '/' Application.
--------------------------------------------------------------------------------
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7471479
System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) +115
System.Double.Parse(String s, NumberStyles style, NumberFormatInfo info) +192
System.Double.Parse(String s, IFormatProvider provider) +25
ComponentArt.Web.UI.NumberInput.set_Value(Nullable`1 value) +81
ComponentArt.Web.UI.NumberInput.LoadViewState(Object savedState) +255
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +183
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221
System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +134
System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +221
System.Web.UI.Page.LoadAllState() +312
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1661
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3618
これはアプリケーションコードには含まれていないため、どうすればよいかわかりません。問題の原因を突き止める方法、またはどこから調べ始めるべきかを知っている人はいますか?
または、コントロールのグループを無効にするより良い方法はありますか?
パネルを作成し、有効に設定することで、ここで提案されているコントロールを無効にする方法も試しましたfalse
が、何もしないようです。
編集: 要求に応じて、コントロールを無効にするための Javascript を次に示します。
function disableChildElements(objId)
{
var theObject = document.getElementById(objId);
var level = 0;
TraverseDOM(theObject, level, disableElement);
}
function TraverseDOM(obj, lvl, actionFunc)
{
for (var i=0; i<obj.childNodes.length; i++)
{
var childObj = obj.childNodes[i];
if (childObj.tagName)
{
actionFunc(childObj);
}
TraverseDOM(childObj, lvl + 1, actionFunc);
}
}
function disableElement(obj)
{
obj.disabled = true;
}
function DisableControls()
{
disableChildElements(castVariablesTable.id);
disableChildElements(oldGradeTable.id);
oldGradePanel.enabled=false;
}
関数の最初の行は正常にDisableControls
機能します。2 番目のエラーが発生します。2 行目を 3 行目に置き換えて別の方法を試しても、何も起こりません。
ASP のキャスト変数テーブルは次のように始まります...
<table id="castVariablesTable" class="normalTable">
<tr>
<td>
<label class="normalText">Number of strands</label>
</td>
<td>
<span class="normalInput">
<MixedZone:NumberInput runat="server"
ID="niNumberOfStrands"
MaxLength="1"
Step="1"
Increment="1"
MaxValue="6"
MinValue="1"
NumberType="Number"
DecimalDigits="0">
</MixedZone:NumberInput>
</span>
等々。
問題の原因となっているテーブルは大きすぎてここに入れることができませんが、同じ種類のものを含んでいます。問題の原因となっている特定のコントロールを実行できませんでした。