0

これは、既存の Visual Studio 2003 プロジェクト (VB で記述) です。フィールドを含む多くのフィールドを含む入力フォームがありdue dateます。このフィールドは、ドロップダウンで選択した値に基づいて入力され、Reason type編集も可能でした。最近、due date(ログインしたユーザーに基づいて) 入力された値を変更できないように、フィールドを無効にする必要がありました。私が直面している問題は、[送信] ボタンをクリックすると、IE ポップアップ ウィンドウが開き、[期日] フィールドの値が消えて空白になることです。

 Private Sub btnSubmitOrdersTab_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmitOrdersTab.Click
        If Not Me.txtPRCEmail.Value.Length = 0 Or Not hPRCEmail.Value.Length = 0 Then
                SubmitClick()
        Else
                RegisterStartupScript("PRCEmail", "<script language=javascript>window.open (""" & CType(Application("cBaseURL"), String) & "administration/supervisors/Orders/prc_email_reason.aspx"",null,""height=200,width=400,status=yes,toolbar=no,menubar=no,location=no"");</script>")
        End If
End Sub

を使って関数のdue date直前の値を取得しようとしましたが、空白です。RegisterStartupScript()duedatevalue = Me.txtDueDate.Value

due dateフィールドが空白になるのを防ぐ方法はありますか。due dateフィールドが無効になっていない場合、これは問題になりません。

これは、期日を無効にするためにのonloadイベントから呼び出している Java Script 関数です。<body>

function DisableDueDate()
            {
                                    if (udisable == "true")
                    document.getElementById("divduedate").setAttribute('disabled',true);

                else
                    document.getElementById("divduedate").setAttribute('disabled',false);

            }

私が無効にした理由は、期日がその<td>横にある gif (サーバー コントロールではない) と一緒にタグにあり、ユーザーが日付を選択できるように、クリックするとカレンダーがポップアップするためです。<td>gif を含むタグのコンテンツ全体を無効にしたい。

4

3 に答える 3

0

Enabledプロパティを False に設定しないでください。代わりに、ReadOnlyプロパティを使用して true に設定してください。

于 2012-09-07T15:00:57.937 に答える
0

Use readonly instead of using disabling the textbox, if you want to read the value of the texbox on server side.

document.getElementById("divduedate").setAttribute('readonly',true);

OR

 document.getElementById("divduedate").readOnly=true 

OR

Using jQuery:

 $('#readonly').attr("readonly", true)

Disabled attribute will not allow "divduedate" to post its value to the server.

于 2012-09-07T14:51:25.403 に答える
0

イベントではbtnSubmitOrdersTab_Click、 の値を に保存し、due dateSessionからPage_Load値を取得してフィールドにSession設定できます。due date

于 2012-09-07T14:54:00.983 に答える