GridView_RowCommandイベントの状態を確認しています。条件に基づいて、SkinIDを設定するか、TextBoxのSkinIDを削除します。UserControlのCodeBehindファイルのTextBoxにSkinIDを設定する方法はありますか
これは私のコードです:
if (dt.Rows[0]["D1Variable"].ToString() == "0")
{
txtMRVD1.Text = dt.Rows[0]["D1"].ToString();
txtMRVD1.ReadOnly = true;
txtMRVD1.SkinID = "txtreadonly";
}
else
{
txtMRVD1.Text = "";
txtMRVD1.ReadOnly = false;
}
しかし、それは次のようなエラーがスローされます。
"The 'SkinId' property can only be set in or before the Page_PreInit event for static controls. For dynamic controls, set the property before adding it to the Controls collection."
この問題を解決するにはどうすればよいですか?
ありがとう – thevan