2

I have the following ModalPopupExtender that contains an AJAX ComboBox, RequiredFieldValidator, and ValidatorCalloutExtender. Outside of the ModalPopup this exact code works. Also, ValidatorCalloutExtender's in the ModalPopup work on other controls like TextBoxes. However the following does not work. The value '0' (default) can be selected and the validator does not display.

However if I take out the AJAX ComboBox and put in a traditional ASP.NET DropDownList instead, it works as expected and shows the ValidatorCalloutExtender. I have used the developer toolbar and can't see anything out of the ordianry.

What do I need to do to make the ValidatorCalloutExtender work with the AJAX ComboBox inside the ModalPopup?

Thanks!

Not working:

<asp:Panel ID="pnlData" runat="server" >
 <table>
  <tr>
    <td>
      <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
         <act:ComboBox ID="cbx1" runat="server" Width="278px" DropDownStyle="DropDownList" AutoCompleteMode="SuggestAppend" CaseSensitive="false" AppendDataBoundItems="true" ToolTip="Select the Name.">
           <asp:ListItem Text="(Please Select the Name)" Value="0" />
         </act:ComboBox>
        <asp:RequiredFieldValidator ID="cbx1Req" runat="server" ControlToValidate="cbx1"
          SetFocusOnError="true" ErrorMessage="Please Select the Name."
          InitialValue="0" Display="None" />
        <act:ValidatorCalloutExtender ID="cbx1ReqE" runat="server"
             TargetControlID="cbx1Req" PopupPosition="Right" />
       </ContentTemplate>
     <Triggers>
       <asp:AsyncPostBackTrigger ControlID="btnAdd" EventName="Click" />
      </Triggers>
    </asp:UpdatePanel>
   </td>
  </tr>
 </table>
</asp:Panel>

<act:ModalPopupExtender ID="DataMPE" runat="server"
  TargetControlID="="btnHidden"
  PopupControlID="pnlData" />

<asp:Button ID="btnHidden" runat="server" Text="Modal Display (Hidden)" style="display:none" />

Works (if I replace the AJAX ComboBox control in code above with a traditonal ASP.NET DropDownList):

<asp:DropDownList ID="cbx1" runat="server" Width="300px" AppendDataBoundItems="true">
    <asp:ListItem Text="(Please Select A Name)" Value="0" />
</asp:DropDownList>

1 Answer 1

0

Don't know if this can help, I had this problem with a required validator.

If found a solution here: http://ajaxcontroltoolkit.codeplex.com/workitem/24417

Had to add javascript to change the controltovalidate property for the internal textbox.

string script = string.Format(@"if({0}) {0}.controltovalidate = ""{1}_TextBox"";", this.reqValidator.ClientID, this.ddlCombo.ClientID);

ScriptManager.RegisterStartupScript(this, this.GetType(), string.Format("validator trick for {0}", this.ClientID), script, true); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.