我有一個ListViewASP.NET:使用RequiredFieldValidator與多個文本框ListView中
<asp:ListView ....>
<asp:TextBox ID="txtComment" ... />
<asp:RequiredFieldValidator ID="rfvComment" ControlToValidate="txtComment" ... />
<act:ValidatorCalloutExtender ID="vceComment" TargetControlID="rfvComment" ... />
<asp:Button ID="btnAddComment" ... />
</asp:ListView>
讓我們說這個的ListView創建以下:
TextBox1的 Button1的
TextBox2中 Button2的
TextBox3 Button3
如果我點擊Button2,RequiredFiledValidator/ValidatorCalloutExtender應用於TextBox1而不是TextBox2,如果我點擊Button3,RequiredFiledValidator/ValidatorCalloutExtender也應用於TextBox1,我希望RequiredFiledValidator/ValidatorCalloutExtender應用於TextBox1旁邊的TextBox按鈕,所以如果我點擊Button3我希望它適用於TextBox3。
有誰知道我該如何做到這一點?
謝謝。
謝謝,這工作完美,但我有一個小問題與ValidatorCalloutExtender雖然,如果我點擊Button1,ValidatorCalloutExtender出現在TextBox1旁邊,但如果我點擊Button3 ValidatorCalloutExtender仍然保留在TextBox1它不會轉移到TextBox3。 –
@EricBergman,我已經更新了我的答案 –
非常感謝您抽出寶貴時間來創建此腳本,但嘗試之後,現在無法使用擴展程序彈出窗口。 –