Google Analytics İzleme

12 Aralık 2011

Sharepoint - InputFormCheckBoxListValidator internet explorer haricindeki browser'larda çalışmıyor

Sharepoint'de custom asp.net aspx sayfa geliştirirken InputFormCheckBoxListValidator kontrolünü kullandım.

<Sharepoint:InputFormCheckBoxList ID="cbSubmitAgree" runat="server" CellPadding="0" CellSpacing="0" RepeatLayout="Flow" CssClass="cblSubmitAgree"   >
                         <asp:ListItem Text="I Agree" Value="true"  />  
                         <asp:ListItem Text="I Am Not Agree" Value="false"  />  
                    </Sharepoint:InputFormCheckBoxList>

                    <Sharepoint:InputFormCheckBoxListValidator ID="rfvSubmitAgree" runat="server"
                            ControlToValidate="cbSubmitAgree"  ErrorMessage="Submit Agree is required" EnableClientScript="true" />

Fakat validasyonun firefox, google chrome ve safari'de çalışmadığını farkettim.
Bunun yerine custom validator kullandım.

Markup kodu:

<script language="javascript" type="text/javascript">
                        var cbSubmitAgreeClientID = '<%= cbSubmitAgree.ClientID %>';
                        function cbSubmitAgree_IsChecked(obj, args) {
                            var checkbox = $get(cbSubmitAgreeClientID);
                            args.IsValid = checkbox.checked;
                        }                      
                    </script>

                    <SharePoint:InputFormCheckBox runat="server" ID="cbSubmitAgree" LabelText="I Agree" />                                      

                    <Sharepoint:InputFormCustomValidator runat="server" ID="cvSubmitAgree"
                        OnServerValidate="cvSubmitAgree_OnServerValidate"
                        ClientValidationFunction="cbSubmitAgree_IsChecked" EnableClientScript="true"
                        ErrorMessage="Submit Agree is required"
                        />

Server side kodu:

protected void cvSubmitAgree_OnServerValidate(object source, ServerValidateEventArgs args)
        {
            //throw new NotImplementedException();
            args.IsValid = cbSubmitAgree.Checked;
        }



Hiç yorum yok: