This is a migrated thread and some comments may be shown as answers.

Validation summary not getting displayed for childgrid's usercontrol popup

3 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pradeep Enugala
Top achievements
Rank 1
Pradeep Enugala asked on 24 May 2010, 06:29 AM
Hi Team,

I have a 3-level Grid with usercontrol popups for edit form. When I enter data in the popup for the 1st level (parent grid) and click save, the data is getting validated and the validation summary is being displayed in a radwindow. But if I do the same for the 2nd level (child grid) popup, it is not displaying the validation summary. It just displays the text "*" if there's an error on validation. How can I get it to display the validation summary?

Btw, the RadGrid is enclosed in a RadAjaxPanel. And childgrid's popup controls are also enclosed in a RadAjaxpanel, RajPanelBar. Could this by any chance have anything to do with the validation summary not getting displayed for the childgrid popup?

Please let me know if you need more information. Thanks for your help!
UserControl - Popup1: 
--------------------------- 
<uc1:ContactDtls ID="uctlLocationDtls1" ValidationGroup="ADDRESS" Title="Address" 
runat="server" /> 
<asp:Button ID="btn_Save" runat="server" Text="Save" CommandName="PerformInsert" 
                            Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>' ValidationGroup="ADDRESS" OnClientClick="ShowAlert2()" /> 
                     
UserControl - Popup2: 
--------------------------- 
<telerik:RadTextBox ID="txt_ContactLName" runat="server" Width="100" MaxLength="50"   ValidationGroup = "CONTACT"                                                       onkeypress="return isCharKey(event);" CausesValidation="true"
</telerik:RadTextBox> 
<asp:RequiredFieldValidator ID="rfv_txt_LastName" ControlToValidate="txt_ContactLName" ValidationGroup="CONTACT" ErrorMessage="Last Name required" Text="*" runat="server"></asp:RequiredFieldValidator> 
<asp:Button ID="btn_Save" runat="server" Text="Save" CommandName="PerformInsert" 
Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>' CausesValidation="true" ValidationGroup="CONTACT" OnClientClick="ShowAlert1()" /> 
<asp:ValidationSummary ID="ValidationSummary1" ShowMessageBox="false" ShowSummary="true" runat="server" ValidationGroup="CONTACT" />                                                      
 
Client.aspx: (File containing the Grid) 
--------------------------------------------- 
<script language="javascript" type="text/javascript"
 
     function ShowAlert1() { 
         var valGroup = Page_ClientValidate("CONTACT"); 
         var summary = document.getElementById('divSummary1'); 
         if (!valGroup) { 
             radalert(summary.innerHTML, 400, 100, 'Summary'); 
             return false
         } 
         else 
             return true
     } 
 
     function ShowAlert2() { 
         var valGroup = Page_ClientValidate("ADDRESS"); 
         var summary = document.getElementById('divSummary2'); 
         if (!valGroup) { 
             radalert(summary.innerHTML, 400, 100, 'Summary'); 
             return false
         } 
         else 
             return true
     } 
 
        function isCharKey(evt) { 
             //debugger; 
            var charCode = (evt.which) ? evt.which : event.keyCode 
            if ((charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123) || charCode == 39 ) { 
                return true
            } 
            else { 
                return false
            } 
        } 
    </script>                                                    

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 27 May 2010, 07:59 AM
Hello Pradeep,

Could you please verify if the Validation controls are also added into the RadAjaxPanel . If they are not added please put the Validators into the RadAjaxPanel together with the RadGrid control and test if the application works correctly.


Best wishes,
Maria Ilieva
the Telerik team


Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Pradeep Enugala
Top achievements
Rank 1
answered on 28 May 2010, 01:22 PM
Hi Maria,

Thanks for responding! Yes, the required field validator controls are within the RadAjaxPanel and right next to the control that they are trying to validate. Below is more code for your reference.

The validation summary is being displayed for the user control (Popuplevel1.ascx) that is being called from Mastertable in RadGrid. But it is not being displayed for the user control (Popuplevel2.ascx) that is being fired from the detail table.

Thanks again for your help!
-Pradeep

ASPX Page: 
--------------- 
<%@ Page Title="" Language="C#" MasterPageFile="~/MainMaster.master" AutoEventWireup="true" 
    CodeFile="PopupIssue.aspx.cs" Inherits="Company_PopupIssue" %> 
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server"
    <telerik:RadScriptBlock runat="server" ID="RadCodeBlock1"
     
        <script language="javascript" type="text/javascript"
 
            function ShowAlert2() { 
                debugger 
                var valGroup = Page_ClientValidate("CONTACT"); 
                alert(valGroup); 
                var summary = document.getElementById('divSummary2'); 
                alert(summary); 
                if (!valGroup) { 
                    //alert(summary.innerHTML); 
                    radalert(summary.innerHTML, 400, 100, 'Summary'); 
                    return false
                } 
                else 
                    return true
            } 
 
            function ShowAlert1() { 
                debugger 
                var valGroup = Page_ClientValidate("ADDRESS"); 
                alert(valGroup); 
                var summary = document.getElementById('divSummary1'); 
                alert(summary); 
                if (!valGroup) { 
                    //alert(summary.innerHTML); 
                    radalert(summary.innerHTML, 400, 100, 'Summary'); 
                    return false
                } 
                else 
                    return true
            } 
 
            function isCharKey(evt) { 
                //debugger; 
                var charCode = (evt.which) ? evt.which : event.keyCode 
                if ((charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123) || charCode == 39) { 
                    return true
                } 
                else { 
                    return false
                } 
            } 
        </script> 
 
    </telerik:RadScriptBlock> 
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="cpMiddleContent" runat="Server"
    <telerik:RadPanelBar ID="PanelBar1" runat="server"></telerik:RadPanelBar> 
    <telerik:RadAjaxPanel ID="pnlCompanyDetls" runat="server" LoadingPanelID="LoadingPanel1"
        <telerik:RadGrid ID="radGrid_ClientAddress" runat="server" ClientSettings-AllowKeyboardNavigation="true" 
            PageSize="10" AllowSorting="true" AllowPaging="true" AutoGenerateColumns="False" 
            GridLines="None" CommandItemStyle-Height="25px" OnNeedDataSource="radGrid_ClientAddress_NeedDataSource" 
            OnDetailTableDataBind="radGrid_ClientAddress_DetailTableDataBind" OnDeleteCommand="radGrid_ClientAddress_DeleteCommand" 
            OnInsertCommand="radGrid_ClientAddress_InsertCommand" OnUpdateCommand="radGrid_ClientAddress_UpdateCommand" 
            AllowAutomaticInserts="false"
            <MasterTableView Name="Locations" DataKeyNames="LOCATION_ID" GridLines="None" CommandItemDisplay="Top" 
                EditMode="PopUp"
                <CommandItemSettings RefreshText="Refresh" /> 
                <CommandItemSettings RefreshImageUrl="" /> 
                <Columns> 
                    <telerik:GridBoundColumn HeaderText="Address" HeaderStyle-Width="250" ItemStyle-Width="250" 
                        DataField="ADDRESS1" EmptyDataText="--" AllowSorting="true" Resizable="false"
                    </telerik:GridBoundColumn> 
                    <telerik:GridButtonColumn CommandName="Edit" HeaderText="Edit" UniqueName="EditColumn" 
                        ButtonType="ImageButton" ImageUrl="~/App_Themes/NewSkin/Grid/edit.gif" ItemStyle-Width="50" 
                        HeaderStyle-Width="50" Resizable="false"
                    </telerik:GridButtonColumn> 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Delete" HeaderStyle-Width="45" 
                        Resizable="false"
                        <ItemTemplate> 
                            <asp:ImageButton ID="img_Location_Delete" runat="server" CommandName="Delete" SkinID="GridDelete" 
                                ImageUrl="~/App_Themes/NewSkin/Grid/delete.gif" /> 
                        </ItemTemplate> 
                        <ItemStyle HorizontalAlign="Center" /> 
                    </telerik:GridTemplateColumn> 
                </Columns> 
                <NoRecordsTemplate> 
                    <div style="height: 80;"
                        <asp:Label ID="lbl_NoRecords" runat="server" Text="No Records are available" /> 
                    </div> 
                </NoRecordsTemplate> 
                <EditFormSettings UserControlName="PopupLevel1.ascx" EditFormType="WebUserControl" 
                    InsertCaption="Add Locations" CaptionFormatString="Update Locations"
                    <EditColumn UniqueName="EditCommandColumn1"
                    </EditColumn> 
                    <PopUpSettings Width="460" Height="300" Modal="true" ScrollBars="None" ZIndex="2500" /> 
                </EditFormSettings> 
                <CommandItemTemplate> 
                    <table width="100%" border="0" cellspacing="0" cellpadding="0"
                        <tr style="height: 20px"
                            <td style="width: 100%; color: #074768" align="right"
                                <asp:LinkButton ID="lnkBtnAddLocation" runat="server" CommandName="InitInsert" Style="font-weight: bold;
                                    padding-right: 2px; color: #074768;"
                                    <asp:ImageButton ID="imgbtn_AddLocation" runat="server" SkinID="AddRecord" CommandName="InitInsert" /> 
                                    Add Location 
                                </asp:LinkButton> 
                            </td> 
                        </tr> 
                    </table> 
                </CommandItemTemplate> 
                <DetailTables> 
                    <telerik:GridTableView AutoGenerateColumns="false" Name="Contacts" DataKeyNames="CONTACT_ID" 
                        DataMember="Contacts" runat="server" ShowHeader="true" EditMode="PopUp" Width="890" 
                        AllowPaging="true" AllowSorting="true" PageSize="5" CommandItemDisplay="Top" 
                        CommandItemStyle-Height="25px"
                        <PagerStyle Mode="NextPrevNumericAndAdvanced" CssClass="rgPager" /> 
                        <Columns> 
                            <telerik:GridBoundColumn HeaderText="First Name" HeaderStyle-Width="60" DataField="FIRSTNAME" 
                                EmptyDataText="--" AllowSorting="true" Resizable="false"
                                <ItemStyle Width="60" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridButtonColumn CommandName="Edit" HeaderText="Edit" UniqueName="EditColumn" 
                                ButtonType="ImageButton" ImageUrl="~/App_Themes/NewSkin/Grid/edit.gif" ItemStyle-Width="30" 
                                HeaderStyle-Width="30" Resizable="false"
                            </telerik:GridButtonColumn> 
                            <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Delete" HeaderStyle-Width="45" 
                                Resizable="false"
                                <ItemTemplate> 
                                    <asp:ImageButton ID="img_Location_Delete" runat="server" CommandName="Delete" SkinID="GridDelete" 
                                        ImageUrl="~/App_Themes/NewSkin/Grid/delete.gif" /> 
                                </ItemTemplate> 
                                <ItemStyle HorizontalAlign="Center" /> 
                            </telerik:GridTemplateColumn> 
                        </Columns> 
                        <NoRecordsTemplate> 
                            <div style="height: 80;"
                                <asp:Label ID="lbl_NoRecords" runat="server" Text="No Records are available" /> 
                            </div> 
                        </NoRecordsTemplate> 
                        <EditFormSettings UserControlName="PopupLevel2.ascx" EditFormType="WebUserControl" 
                            InsertCaption="Add Contacts" CaptionFormatString="Update Contacts"
                            <EditColumn UniqueName="EditCommandColumn1"
                            </EditColumn> 
                            <PopUpSettings Width="650" Height="400" Modal="true" ScrollBars="None" ZIndex="2500" /> 
                        </EditFormSettings> 
                        <CommandItemTemplate> 
                            <table width="100%" border="0" cellspacing="0" cellpadding="0"
                                <tr style="height: 20px"
                                    <td style="width: 100%; color: #074768" align="right"
                                        <asp:LinkButton ID="lnkBtnAddContact" runat="server" CommandName="InitInsert" Style="font-weight: bold;
                                            padding-right: 10px; color: #074768;"
                                            <asp:ImageButton ID="imgbtn_AddContact" runat="server" SkinID="AddRecord" CommandName="InitInsert" /> 
                                            Add Contact 
                                        </asp:LinkButton> 
                                    </td> 
                                </tr> 
                            </table> 
                        </CommandItemTemplate> 
                    </telerik:GridTableView> 
                </DetailTables> 
            </MasterTableView> 
            <GroupingSettings CaseSensitive="false" /> 
        </telerik:RadGrid> 
    </telerik:RadAjaxPanel> 
    <telerik:RadWindowManager runat="server" ID="RadWindowManager1"
    </telerik:RadWindowManager> 
</asp:Content> 
 
ASPX.CS file 
--------------- 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using UserModel; 
using System.Collections; 
using Telerik.Web.UI; 
 
public partial class Company_PopupIssue : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e) 
    { 
 
    } 
    #region radGrid Events 
 
    protected void radGrid_ClientAddress_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    { 
        UserModelDataContext ucontext = new UserModelDataContext(); 
        IList Query = null
        try 
        { 
            Query = (from clo in ucontext.TBL_COMPANY_LOCATIONs                      
                     where clo.COMPANY_ID == 123 && clo.STATUS_ID == 1 
                     select new 
                     {    
                         clo.LOCATION_ID, 
                         ADDRESS1 = clo.ADDRESS1                          
                     }).ToList(); 
            radGrid_ClientAddress.DataSource = Query; 
 
 
        } 
        catch (Exception ex) 
        { 
            throw ex; 
        } 
    } 
 
    protected void radGrid_ClientAddress_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e) 
    { 
 
        UserModelDataContext ucontext = new UserModelDataContext(); 
        IList Query = null
        try 
        { 
            Company obj = new Company(); 
            GridDataItem parentItem = e.DetailTableView.ParentItem as GridDataItem; 
 
            switch (e.DetailTableView.DataMember) 
            { 
                case "Contacts"
                    { 
                        int LocationID = Convert.ToInt32(parentItem.GetDataKeyValue("LOCATION_ID").ToString()); 
                        Query = (from cc in ucontext.TBL_COMPANY_CONTACTs 
                                 join clcl in ucontext.TBL_COMPANY_LOCATION_CONTACT_LINKs on cc.CONTACT_ID equals clcl.CONTACT_ID 
                                 where clcl.LOCATION_ID == LocationID && cc.STATUS_ID == 1 
                                 select new 
                                 { 
                                     cc.CONTACT_ID,                                      
                                     FIRSTNAME = cc.CONTACT_FIRST_NAME,                                      
                                 }).OrderBy(pi => pi.FIRSTNAME).ToList(); 
                        e.DetailTableView.DataSource = Query; 
                        break
                    }                 
            } 
        } 
        catch (Exception ex) 
        { 
            throw ex; 
        } 
 
 
    } 
 
 
    protected void radGrid_ClientAddress_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        try 
        { 
             
        } 
        catch (Exception ex) 
        { 
            throw ex; 
        } 
 
    } 
 
    protected void radGrid_ClientAddress_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
    { 
        
 
    } 
 
 
    protected void radGrid_ClientAddress_InsertCommand(object source, GridCommandEventArgs e) 
    { 
         
    } 
 
    protected void radGrid_ClientAddress_UpdateCommand(object source, GridCommandEventArgs e) 
    { 
        
    } 
    #endregion 
 
PopupLevel1.ascx file: 
----------------------- 
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PopupLevel1.ascx.cs" Inherits="Company_PopupLevel1" %> 
 
<table class="boxboder" width="100%" cellspacing="0" cellpadding="0"
    <tr> 
        <td> 
            <table width="100%" cellspacing="0" cellpadding="0"
                <tr> 
                    <td class="boxheaderbg"
                        <asp:Label ID="lbl_Header" runat="server" Text="" /> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                        <table width="98%" align="center" cellpadding="0" cellspacing="0"
                            <tr> 
                                <td colspan="9" height="10"
                                </td> 
                            </tr> 
                            <tr> 
                                <td> 
                                    <asp:Label ID="lbl_Address1" runat="server" Text="Address1"></asp:Label><span 
                                        id="spanAddr" class="redstar" visible="false" runat="server">*</span> 
                                </td> 
                                <td> 
                                    &nbsp; 
                                </td> 
                                <td colspan="7"
                                    <Telerik:RadTextBox ID="txt_address1" runat="server" Text='<%# DataBinder.Eval( Container, "DataItem.ADDRESS1") %>' 
                                        MaxLength="250" Width="325px" ValidationGroup="ADDRESS"></Telerik:RadTextBox> 
                                    <asp:RequiredFieldValidator ID="valReq_address1" ControlToValidate="txt_address1" Text="*" 
                                        ValidationGroup="ADDRESS" Display="None" runat="server" ErrorMessage="Address Required"></asp:RequiredFieldValidator> 
                                </td> 
                            </tr>                             
                        </table> 
                    </td> 
                </tr> 
                <tr> 
                    <td height="10"
                    </td> 
                </tr> 
                <tr> 
                    <td class="boxContentBg"
                        &nbsp; 
                    </td> 
                </tr> 
            </table> 
        </td> 
    </tr> 
        <tr align="center"
        <td align="center"
            <asp:Button ID="btn_Save" runat="server" Text="Save" CommandName="PerformInsert" 
                Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>' CausesValidation="true" 
                ValidationGroup="ADDRESS" OnClientClick="ShowAlert1()" /> 
            <asp:Button ID="btn_Update" runat="server" Text="Update" CommandName="Update" OnClientClick="ShowAlert1()" 
                Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>' CausesValidation="true" 
                ValidationGroup="ADDRESS" /> 
            <asp:Button ID="btn_Cancel" runat="server" Text="Cancel" CommandName="Cancel" /> 
            <div id="divSummary1" style="visibility: hidden; display: none"
                <asp:ValidationSummary ID="ValidationSummary1" ShowMessageBox="false" ShowSummary="true" 
                    runat="server" ValidationGroup="CONTACT" /> 
            </div> 
        </td> 
    </tr> 
</table> 
 
 
PopupLevel1.ascx.cs file: 
---------------------------- 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using UserModel; 
 
public partial class Company_PopupLevel1 : System.Web.UI.UserControl 
    UserModelDataContext mcContext = new UserModelDataContext(); 
    object objLocationID = null
 
    private object _dataItem = null
    public object DataItem 
    { 
        get 
        { 
            return this._dataItem; 
        } 
        set 
        { 
            this._dataItem = value; 
        } 
    } 
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
 
    } 
    #region Web Form Designer generated code 
 
    override protected void OnInit(EventArgs e) 
    { 
        // 
        // CODEGEN: This call is required by the ASP.NET Web Form Designer. 
        // 
        InitializeComponent(); 
        base.OnInit(e); 
    } 
 
    /// <summary> 
    ///        Required method for Designer support - do not modify 
    ///        the contents of this method with the code editor. 
    /// </summary> 
    private void InitializeComponent() 
    { 
        this.DataBinding += new System.EventHandler(this.WebUserControl_DataBinding); 
 
    } 
 
    protected void WebUserControl_DataBinding(object sender, System.EventArgs e) 
    { 
        try 
        { 
            UserModelDataContext context = new UserModelDataContext();  
            objLocationID = DataBinder.Eval(DataItem, "LOCATION_ID"); 
 
            if (objLocationID != null && objLocationID.ToString().Length > 0) 
            { 
 
                int locationID = Convert.ToInt32(objLocationID.ToString()); 
 
                UserModel.TBL_COMPANY_LOCATION tblLocation = context.TBL_COMPANY_LOCATIONs.Where(p => p.LOCATION_ID == locationID && p.STATUS_ID == Common.GetActiveStatusID()).Single(); 
                lbl_Address1.Text = tblLocation.ADDRESS1; 
            } 
        } 
        catch (Exception ex) 
        { 
            throw ex; 
        } 
    } 
    #endregion 
 
 
     
 
 
 
PopupLevel2.ascx file 
-------------------------- 
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PopupLevel2.ascx.cs" Inherits="Company_PopupLevel2" %> 
<table id="tbl1" runat="server" width="98%" cellspacing="0" cellpadding="0" bgcolor="White"
    <tr> 
        <td height="10"
        </td> 
    </tr> 
    <tr> 
        <td> 
            <telerik:RadAjaxPanel ID="pnlNewContact" runat="server" LoadingPanelID="LoadingPanel1"
                <telerik:RadPanelBar Width="99%" ID="radpnl_NewContact" runat="server" ExpandMode="SingleExpandedItem" 
                    AllowCollapseAllItems="true"
                    <Items> 
                        <telerik:RadPanelItem Text="Add New Contact" Value="New Contact" runat="server" Expanded="true" 
                            Width="100%"
                            <Items> 
                                <telerik:RadPanelItem runat="server" Value="NewContact"
                                    <ItemTemplate> 
                                        <asp:Panel ID="pnl_NewContact" runat="server"
                                            <table align="center" width="100%"
                                                <tr> 
                                                    <td height="10px" colspan="2"
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                    <td align="left" valign="top" style="margin-left: 20px;"
                                                        <table class="boxboder" width="100%" cellspacing="0" cellpadding="0"
                                                            <tr> 
                                                                <td class="boxheaderbg" colspan="2"
                                                                    <asp:Label ID="lbl_ContactName" runat="server" Text="Contact Name"></asp:Label> 
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td align="left" class="AltGrid"
                                                                    <table width="100%" cellpadding="0" cellspacing="0" border="0"
                                                                        <tr> 
                                                                            <td> 
                                                                                <table width="100%" cellspacing="0" cellpadding="0" border="0"
                                                                                    <tr> 
                                                                                        <td height="10" colspan="3"
                                                                                        </td> 
                                                                                    </tr> 
                                                                                    <tr> 
                                                                                        <td> 
                                                                                            <asp:Label ID="lbl_ContactFName" Text=" First Name" runat="server"></asp:Label> 
                                                                                        </td> 
                                                                                        <td> 
                                                                                        </td> 
                                                                                        <td> 
                                                                                            <telerik:RadTextBox ID="txt_ContactFName" runat="server" Width="100" MaxLength="50" 
                                                                                                CausesValidation="true" onkeypress="return isCharKey(event);" ValidationGroup="CONTACT"
                                                                                            </telerik:RadTextBox> 
                                                                                            <asp:RequiredFieldValidator ID="rfv_txt_FirstName" ControlToValidate="txt_ContactFName" 
                                                                                                ValidationGroup="CONTACT" ErrorMessage="First Name required" Text="*" runat="server"></asp:RequiredFieldValidator> 
                                                                                        </td> 
                                                                                    </tr> 
                                                                                    <tr> 
                                                                                        <td height="8"
                                                                                        </td> 
                                                                                    </tr> 
                                                                                    <tr> 
                                                                                        <td height="10" colspan="3" class="boxContentBg"
                                                                                        </td> 
                                                                                    </tr> 
                                                                                </table> 
                                                                            </td> 
                                                                            <td> 
                                                                            </td> 
                                                                        </tr> 
                                                                    </table> 
                                                                </td> 
                                                            </tr> 
                                                        </table> 
                                                    </td> 
                                                </tr> 
                                                <tr> 
                                                </tr> 
                                            </table> 
                                        </asp:Panel> 
                                    </ItemTemplate> 
                                </telerik:RadPanelItem> 
                            </Items> 
                        </telerik:RadPanelItem> 
                    </Items> 
                </telerik:RadPanelBar> 
            </telerik:RadAjaxPanel> 
        </td> 
    </tr> 
    <tr> 
        <td height="10"
        </td> 
    </tr> 
        <tr align="center"
        <td align="center"
            <asp:Button ID="btn_Save" runat="server" Text="Save" CommandName="PerformInsert" 
                Visible='<%# DataItem is Telerik.Web.UI.GridInsertionObject %>' CausesValidation="true" 
                ValidationGroup="CONTACT" OnClientClick="ShowAlert2()" /> 
            <asp:Button ID="btn_Update" runat="server" Text="Update" CommandName="Update" OnClientClick="ShowAlert2()" 
                Visible='<%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %>' CausesValidation="true" 
                ValidationGroup="CONTACT" /> 
            <asp:Button ID="btn_Cancel" runat="server" Text="Cancel" CommandName="Cancel" /> 
            <div id="divSummary2" style="visibility: hidden; display: none"
                <asp:ValidationSummary ID="ValidationSummary1" ShowMessageBox="false" ShowSummary="true" 
                    runat="server" ValidationGroup="CONTACT" /> 
            </div> 
        </td> 
    </tr> 
</table> 
 
 
PopupLevel2.ascx.cs file 
---------------------------- 
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using Telerik.Web.UI; 
using UserModel; 
 
public partial class Company_PopupLevel2 : System.Web.UI.UserControl 
    UserModelDataContext mcContext = new UserModelDataContext(); 
    private object _dataItem = null
    object objContactID = null
    Company company = null
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        
    } 
    #region Code to populate the user control Phone details 
 
    override protected void OnInit(EventArgs e) 
    { 
        // 
        // CODEGEN: This call is required by the ASP.NET Web Form Designer. 
        // 
        InitializeComponent(); 
        base.OnInit(e); 
    } 
 
    /// <summary> 
    ///        Required method for Designer support - do not modify 
    ///        the contents of this method with the code editor. 
    /// </summary> 
    private void InitializeComponent() 
    { 
        this.DataBinding += new System.EventHandler(this.WebUserControl_DataBinding); 
 
    } 
 
    protected void WebUserControl_DataBinding(object sender, System.EventArgs e) 
    { 
        try 
        { 
            RadPanelItem panelItem1 = (RadPanelItem)((RadPanelItem)radpnl_NewContact.Items[0]).Items[0]; 
 
            objContactID = DataBinder.Eval(DataItem, "CONTACT_ID"); 
 
            if (objContactID != null && objContactID.ToString().Length > 0) 
            {                 
 
                radpnl_NewContact.Items[0].Text = "Update Contact"
 
                RadTextBox FName = (RadTextBox)panelItem1.FindControl("txt_ContactFName"); 
                FName.Text = DataBinder.Eval(DataItem, "FIRSTNAME").ToString();  
 
            } 
             
        } 
        catch (Exception ex) 
        { 
        } 
    } 
    #endregion 
    #region "Public properties" 
    // To retrieve the RelationShip value of selected item. 
    public object DataItem 
    { 
        get 
        { 
            return this._dataItem; 
        } 
        set 
        { 
            this._dataItem = value; 
        } 
    } 
    #endregion 
 
 
 
 
 
 
  
 
 

0
Pradeep Enugala
Top achievements
Rank 1
answered on 29 May 2010, 06:23 AM
I found the cause of the issue.. I had an ajaxpanel in the user control and inside that a panel bar. In the panel bar I had my textbox and other controls and requiredfieldvalidators. I moved the ajaxpanel into the panelbar near the textbox. And I moved the requiredfieldvalidator outside the ajaxpanel. This worked!


Tags
Grid
Asked by
Pradeep Enugala
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Pradeep Enugala
Top achievements
Rank 1
Share this question
or