トップ回答者
[ajaxToolkit]Methodを追加したら、テキストが変更できなくなった

質問
-
こちらのフォーラムにはいつもお世話になっております、Hiropon37です。
現在VS2008 + ASP.NET + VBで開発をしており、
TextBoxの数値の変更に、ajaxToolkitのNumericUpDownExtenderを使用しています。
画面の仕様を簡単に申しますと、
入力項目が「年月日時分秒1」~「年月日時分秒2」のようにあり、指定された期間の画像ファイルをダウンロードする画面です。
「年月日時分秒」TextBoxそれぞれにNumericUpDownExtenderを追加し、TextBoxの値を上げ下げします。
追加機能で、
値が上限値に達した時、もう一度値を上げるとTextBoxに下限値を表示させます。(例:秒59→0、下限値の時も同様)
この追加機能は、VSのデザインビューでTextBoxを選択すると表示される「TextBox タスク」で「Add "Get Next" NumericUpDown page method」を選択し追加しております。
問題点ですが、
Methodを追加する前はTextBoxの値を直接入力で書き換えることが可能だったのですが、
Methodを追加すると、値の書き換えが出来なくなりました。
ネットで検索してもなかなか情報が見つからず困っています。
お力添え、よろしくおねがいします。
.aspx
<asp:TextBox ID="lYMD1_M" runat="server" Width="30px" Height="16px" MaxLength ="2" CssClass="TextBoxInpNumC" onfocus="this.select();" /> <ajaxToolkit:NumericUpDownExtender ID="lYMD1_M_NumericUpDownExtender" runat="server" Enabled="True" Maximum="12" Minimum="1" RefValues="" ServiceDownMethod="GetPreviousValue3" ServiceDownPath="" ServiceUpMethod="GetNextValue3" Tag="" TargetButtonDownID="" TargetButtonUpID="" TargetControlID="lYMD1_M" Width="50"> </ajaxToolkit:NumericUpDownExtender> 月
.aspx.vb
<System.Web.Services.WebMethodAttribute()> <System.Web.Script.Services.ScriptMethodAttribute()> Public Shared Function GetNextValue3(ByVal current As System.Int32, ByVal tag As System.String) As System.Int32 Dim retnum As System.Int32 If current = 12 Then retnum = 1 Else retnum = current + 1 End If Return retnum End Function <System.Web.Services.WebMethodAttribute()> <System.Web.Script.Services.ScriptMethodAttribute()> Public Shared Function GetPreviousValue3(ByVal current As System.Int32, ByVal tag As System.String) As System.Int32 Dim retnum As System.Int32 If current = 1 Then retnum = 12 Else retnum = current - 1 End If Return retnum End Function
回答
-
次の URL の記事で言及されていますが、WebMethod にバインドしたり RefValues を使用すると、テキストボックスはリード オンリーになるようです。
Ajax Control Toolkit - Part One
http://dotnetslackers.com/columns/ajax/AjaxControlToolkitPartOne.aspx
First, when binding to WebService/PageMethods orRefValues
the extended textbox becomes read-only, which ensure the user will never be able to input invalid data in that textbox.
JavaScript のソースでも、initialize の中で確かにその通りのコーディングがされていますね。(Release: 30390 で確認)
AjaxControlToolkit.NumericUpDownBehavior.prototype = {
initialize: function() {
// ...中略...
if ((this._refValuesValue) || (this._serviceUpMethodValue) || (this._serviceDownMethodValue)) {
this._elementTextBox.readOnly = true;
} else {
this._elementTextBox.readOnly = false;
}- 回答としてマーク Hiropon37 2010年4月12日 3:00
すべての返信
-
次の URL の記事で言及されていますが、WebMethod にバインドしたり RefValues を使用すると、テキストボックスはリード オンリーになるようです。
Ajax Control Toolkit - Part One
http://dotnetslackers.com/columns/ajax/AjaxControlToolkitPartOne.aspx
First, when binding to WebService/PageMethods orRefValues
the extended textbox becomes read-only, which ensure the user will never be able to input invalid data in that textbox.
JavaScript のソースでも、initialize の中で確かにその通りのコーディングがされていますね。(Release: 30390 で確認)
AjaxControlToolkit.NumericUpDownBehavior.prototype = {
initialize: function() {
// ...中略...
if ((this._refValuesValue) || (this._serviceUpMethodValue) || (this._serviceDownMethodValue)) {
this._elementTextBox.readOnly = true;
} else {
this._elementTextBox.readOnly = false;
}- 回答としてマーク Hiropon37 2010年4月12日 3:00