The edit link is not firing on a TreeList

6 posts, 1 answers
  1. Chris
    Chris avatar
    15 posts
    Member since:
    Oct 2010

    Posted 13 Jan 2012 Link to this post

    Hello all,

    I have this page:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UpdateProblem.aspx.cs" Inherits="CellLab.WebForms.UpdateProblem" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <telerik:RadWindowManager ID="RadWindowManagerUI" runat="server">
    	</telerik:RadWindowManager>
    	<asp:Button runat="server" ID="hiddenTargetControlForModalPopup" style="display:none"/>
    		<telerik:RadScriptManager ID="ScriptManager1" runat="server" 
    			EnableTheming="True">            
    		</telerik:RadScriptManager>    
                    <p>
    		            <asp:Label ID="LabelMsg" runat="server" Text="Label" Visible="false"></asp:Label>
    		        </p>    
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
                <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
                    <fieldset> 
    			        <legend>Sample(s) information</legend> 
    			        <p> 
    				        <label class="demoHeaders"><b>Kit Number:</b></label>             
    				        <asp:Label ID="LabelKitNumber" CssClass="demoHeaders" runat="server"></asp:Label>
    			        </p>
    			        <p> 
    				        <label for="<%# DropDownListStudy.ClientID %>">Study: </label>             
    				        <asp:DropDownList ID="DropDownListStudy" runat="server" AutoPostBack="True" onselectedindexchanged="DropDownListStudy_SelectedIndexChanged"></asp:DropDownList>  
    				        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Study is required." Text="Study is required." ControlToValidate="DropDownListStudy" CssClass="validate_error" InitialValue="-1"></asp:RequiredFieldValidator>
    			        </p>
    			        <p> 
    				        <label>Disease: </label>             
    				        <asp:Label ID="LabelDisease" CssClass="demoHeaders" runat="server"></asp:Label>
    			        </p>
    			        <p> 
    				        <label for="<%# TextBoxSite.ClientID %>">Site: </label>             
    				        <asp:TextBox ID="TextBoxSite" CssClass="sf" runat="server"></asp:TextBox>
    			        </p>
    			        <p> 
    				        <label for="<%# TextBoxFamNo.ClientID %>">Family number: </label>             
    				        <asp:TextBox ID="TextBoxFamNo" CssClass="sf" runat="server"></asp:TextBox>
    			        </p>
    			        <p> 
    				        <label for="<%# TextBoxIndNo.ClientID %>">Individual number: </label>             
    				        <asp:TextBox ID="TextBoxIndNo" CssClass="sf" runat="server"></asp:TextBox>
    			        </p>
    			        <p> 
    				        <label for="<%# TextBoxIndNo.ClientID %>">Notes: </label>             
    				        <asp:TextBox ID="TextBoxNotes" CssClass="lf" runat="server" TextMode="MultiLine"></asp:TextBox>
    			        </p>
    			        <p> 
                            <label>Samples:</label><asp:LinkButton ID="LinkButtonAddEditSample" runat="server" CssClass="button" onclick="LinkButtonAddEditSample_Click" CausesValidation="false"><span class="ui-icon ui-icon-circle-plus"></span>Add Sample...</asp:LinkButton>                
    			 		</p>                      
                        <telerik:RadTreeList ID="RadTreeListSamples" runat="server" AllowSorting="True" 
                            AutoGenerateColumns="False" CssClass="fullwidth" DataKeyNames="SampleNumber" 
                            EditMode="InPlace" onitemdatabound="RadTreeListSamples_ItemDataBound1" 
                            onneeddatasource="RadTreeListSamples_NeedDataSource1" 
                            onupdatecommand="RadTreeListSamples_UpdateCommand1" PageSize="15" 
                            ParentDataKeyNames="ParentSample" Skin="WebBlue" 
                            onitemcommand="RadTreeListSamples_ItemCommand">
                            <AlternatingItemStyle CssClass="odd" />
                            <Columns>
    			                <telerik:TreeListBoundColumn DataField="DateReceived" UniqueName="DateReceived" HeaderText="Date Received" DataFormatString="{0:M/dd/yyyy}" HeaderStyle-Width="120"/>
    			                <telerik:TreeListBoundColumn DataField="DateCollected" UniqueName="DateCollected" HeaderText="Date Collected" DataFormatString="{0:M/dd/yyyy}" HeaderStyle-Width="100"/>
    			                <telerik:TreeListBoundColumn DataField="SampleNumber" UniqueName="SampleNumber" HeaderText="Sample Number" ReadOnly="true" />
    			                <telerik:TreeListBoundColumn DataField="StatusId" UniqueName="StatusId" HeaderText="Status" HeaderStyle-Width="75" ReadOnly="true" />
    			                <telerik:TreeListBoundColumn DataField="InitialAmount" UniqueName="InitialAmount" HeaderText="Initial Amount" HeaderStyle-Width="100"/>
    			                <telerik:TreeListBoundColumn DataField="UnitId" UniqueName="UnitId" HeaderText="Units" HeaderStyle-Width="50" ReadOnly="true" />
    			                <telerik:TreeListBoundColumn DataField="TubeTypeId" UniqueName="TubeTypeId" HeaderText="Tube Type" HeaderStyle-Width="100" ReadOnly="true"/>
    			                <telerik:TreeListBoundColumn DataField="Notes" UniqueName="Notes" HeaderText="Notes" />
    			                <telerik:TreeListBoundColumn DataField="ParentSample" UniqueName="ParentSample" HeaderText="Parent Sample" ReadOnly="true"/> 
    			                <telerik:TreeListEditCommandColumn UniqueName="EditCommandColumn" ButtonType="LinkButton" ShowAddButton="false"/>                        
    			                <telerik:TreeListTemplateColumn UniqueName="Deletecol" ReadOnly="true">
    				                <ItemTemplate>
    					                <asp:LinkButton ID="link1" Text="Delete" OnClientClick="if (!confirm('Are you sure?')) return false;"
    						                CommandName="Delete" runat="server" />                        
    						                <asp:HiddenField ID="ParentSample" Value='<%# Eval("ParentSample")%>' runat="server" />
    				                </ItemTemplate>
    			                </telerik:TreeListTemplateColumn> 
    		                </Columns>
                            <NoRecordsTemplate>
                                <div class="message information">
    						        <h2>No samples added yet.</h2>
    						        <p>&nbsp;</p>
    					        </div>
                            </NoRecordsTemplate>
                        </telerik:RadTreeList>
                    </fieldset>
                </telerik:RadAjaxPanel>			   
                <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderAddEditSample" runat="server"                
    				TargetControlID="hiddenTargetControlForModalPopup"                
    				PopupControlID="PanelSamples"
    				BackgroundCssClass="modalBackground"                 
    				DropShadow="true"                                
    				>
    				</ajaxToolkit:ModalPopupExtender>       
        </form>
    </body>
    </html>

    With this Code behind:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    namespace CellLab.WebForms
    {
        class DataTest
        {
            private DateTime dateReceived;
     
            public DateTime DateReceived
            {
                get { return dateReceived; }
                set { dateReceived = value; }
            }
            private DateTime dateCollected;
     
            public DateTime DateCollected
            {
                get { return dateCollected; }
                set { dateCollected = value; }
            }
            private string sampleNumber;
     
            public string SampleNumber
            {
                get { return sampleNumber; }
                set { sampleNumber = value; }
            }
            private string status;
     
            public string StatusId
            {
                get { return status; }
                set { status = value; }
            }
            private float initialAmount;
     
            public float InitialAmount
            {
                get { return initialAmount; }
                set { initialAmount = value; }
            }
            private string units;
     
            public string UnitId
            {
                get { return units; }
                set { units = value; }
            }
            private string tubeType;
     
            public string TubeTypeId
            {
                get { return tubeType; }
                set { tubeType = value; }
            }
            private string notes;
     
            public string Notes
            {
                get { return notes; }
                set { notes = value; }
            }
            private string parentSample;
     
            public string ParentSample
            {
                get { return parentSample; }
                set { parentSample = value; }
            }
        }
     
        public partial class UpdateProblem : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
     
            }
     
            private void BindData()
            {
                DataTest sample1 = new DataTest();
                sample1.DateReceived = DateTime.Now;
                sample1.DateCollected = DateTime.Now;
                sample1.SampleNumber = "1";
                sample1.StatusId = "NA";
                sample1.InitialAmount = 9.0f;
                sample1.UnitId = "ml";
                sample1.TubeTypeId = "ACD";
                sample1.Notes = "Notes sample 1";
                sample1.ParentSample = null;
     
                DataTest sample2 = new DataTest();
                sample2.DateReceived = DateTime.Now.AddDays(1);
                sample2.DateCollected = DateTime.Now.AddDays(1);
                sample2.SampleNumber = "2";
                sample2.StatusId = "AVAIL";
                sample2.InitialAmount = 0.0f;
                sample2.UnitId = "ml";
                sample1.TubeTypeId = "Cryovial";
                sample2.Notes = "Notes sample 2";
                sample2.ParentSample = "1";
     
                List<DataTest> rows = new List<DataTest>();
                rows.Add(sample1);
                rows.Add(sample2);
                RadTreeListSamples.DataSource = rows;
            }
     
            protected void DropDownListStudy_SelectedIndexChanged(object sender, EventArgs e)
            {
     
            }
     
            protected void LinkButtonAddEditSample_Click(object sender, EventArgs e)
            {
     
            }
     
            protected void RadTreeListSamples_ItemDataBound1(object sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e)
            {
     
            }
     
            protected void RadTreeListSamples_UpdateCommand1(object sender, Telerik.Web.UI.TreeListCommandEventArgs e)
            {
                RadWindowManagerUI.RadAlert("This is getting updated!", 330, 100, "DNA CellLab"null);
            }
     
            protected void RadTreeListSamples_NeedDataSource1(object sender, Telerik.Web.UI.TreeListNeedDataSourceEventArgs e)
            {
                BindData();
            }
     
            protected void RadTreeListSamples_ItemCommand(object sender, Telerik.Web.UI.TreeListCommandEventArgs e)
            {
     
            }
        }
    }

    Problem is, when I click on the edit button, and then I click on update, nothing happens. The update event is not fired at all or in other words, I don't get the RadAlert. 

    Please help...

  2. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 17 Jan 2012 Link to this post

    Hello Chris,

    I tried your code but on my side the event fired as expected with the latest official version of RadControls. You can see a video here:
    http://screencast.com/t/HDHquBjKAB6

    I am also attaching my test project. Check it out and let me know if you notice anything wrong with it.

    All the best,
    Tsvetina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chris
    Chris avatar
    15 posts
    Member since:
    Oct 2010

    Posted 18 Jan 2012 Link to this post

    Here is the thing:

    In the test project you sent, you conveniently removed this from the .aspx file:

     <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderAddEditSample" runat="server"                
    				TargetControlID="hiddenTargetControlForModalPopup"                
    				PopupControlID="PanelSamples"
    				BackgroundCssClass="modalBackground"                 
    				DropShadow="true"                                
    				>
    				</ajaxToolkit:ModalPopupExtender> 

    So yeah, without that, it does work. I Kindly ask you to try the code exactly as I sent it, and you'll see that it does not work. Does the telerik component conflicts with the ajaxToolkit?  

    Thanks,
  5. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 19 Jan 2012 Link to this post

    Hello Chris,

    I did not add the popup extender, as the popup control that it pointed to was not declared anywhere on your page. When I used your code without any changes, it errored out on the client, as the popup extender could not find its popup element. This prevented the AJAX request that updates the RadTreeList from firing, as the client script was already broken.
    When I added an asp:Panel with the respective ID : PanelSamples, there were no client errors and the treelist also worked as expected.
    <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderAddEditSample" runat="server"
        TargetControlID="hiddenTargetControlForModalPopup" PopupControlID="PanelSamples"
        BackgroundCssClass="modalBackground" DropShadow="true">
    </ajaxToolkit:ModalPopupExtender>
    <asp:Panel ID="PanelSamples" runat="server">
    Test
    </asp:Panel>

    The modified project is attached to this post.


    All the best,
    Tsvetina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  6. Chris
    Chris avatar
    15 posts
    Member since:
    Oct 2010

    Posted 20 Jan 2012 Link to this post

    Tsvetina,

    Thank you very much for your help and patience. I apologize because I have been trying to recreate the problem with as little code as possible, so I did not send my code complete. Let me give it another try: I'm certain now that the problem then must be on the Panel part of the .aspx file (thank you for helping me figuring that out). Here is now the full code:

    First, default.aspx:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <telerik:RadWindowManager ID="RadWindowManagerUI" runat="server">
            </telerik:RadWindowManager>
            <asp:Button runat="server" ID="hiddenTargetControlForModalPopup" Style="displaynone" />
            <telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True">
            </telerik:RadScriptManager>
            <p>
                <asp:Label ID="LabelMsg" runat="server" Text="Label" Visible="false"></asp:Label>
            </p>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
                <fieldset>
                    <legend>Sample(s) information</legend>
                    <p>
                        <label class="demoHeaders">
                            <b>Kit Number:</b></label>
                        <asp:Label ID="LabelKitNumber" CssClass="demoHeaders" runat="server"></asp:Label>
                    </p>
                    <p>
                        <label for="<%# DropDownListStudy.ClientID %>">
                            Study:
                        </label>
                        <asp:DropDownList ID="DropDownListStudy" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownListStudy_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Study is required."
                            Text="Study is required." ControlToValidate="DropDownListStudy" CssClass="validate_error"
                            InitialValue="-1"></asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <label>
                            Disease:
                        </label>
                        <asp:Label ID="LabelDisease" CssClass="demoHeaders" runat="server"></asp:Label>
                    </p>
                    <p>
                        <label for="<%# TextBoxSite.ClientID %>">
                            Site:
                        </label>
                        <asp:TextBox ID="TextBoxSite" CssClass="sf" runat="server"></asp:TextBox>
                    </p>
                    <p>
                        <label for="<%# TextBoxFamNo.ClientID %>">
                            Family number:
                        </label>
                        <asp:TextBox ID="TextBoxFamNo" CssClass="sf" runat="server"></asp:TextBox>
                    </p>
                    <p>
                        <label for="<%# TextBoxIndNo.ClientID %>">
                            Individual number:
                        </label>
                        <asp:TextBox ID="TextBoxIndNo" CssClass="sf" runat="server"></asp:TextBox>
                    </p>
                    <p>
                        <label for="<%# TextBoxIndNo.ClientID %>">
                            Notes:
                        </label>
                        <asp:TextBox ID="TextBoxNotes" CssClass="lf" runat="server" TextMode="MultiLine"></asp:TextBox>
                    </p>
                    <p>
                        <label>
                            Samples:</label><asp:LinkButton ID="LinkButtonAddEditSample" runat="server" CssClass="button"
                                OnClick="LinkButtonAddEditSample_Click" CausesValidation="false"><span class="ui-icon ui-icon-circle-plus"></span>Add Sample...</asp:LinkButton>
                    </p>
                    <telerik:RadTreeList ID="RadTreeListSamples" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                        CssClass="fullwidth" DataKeyNames="SampleNumber" EditMode="InPlace" OnItemDataBound="RadTreeListSamples_ItemDataBound1"
                        OnNeedDataSource="RadTreeListSamples_NeedDataSource1" OnUpdateCommand="RadTreeListSamples_UpdateCommand1"
                        PageSize="15" ParentDataKeyNames="ParentSample" Skin="WebBlue" OnItemCommand="RadTreeListSamples_ItemCommand">
                        <AlternatingItemStyle CssClass="odd" />
                        <Columns>
                            <telerik:TreeListBoundColumn DataField="DateReceived" UniqueName="DateReceived" HeaderText="Date Received"
                                DataFormatString="{0:M/dd/yyyy}" HeaderStyle-Width="120" />
                            <telerik:TreeListBoundColumn DataField="DateCollected" UniqueName="DateCollected"
                                HeaderText="Date Collected" DataFormatString="{0:M/dd/yyyy}" HeaderStyle-Width="100" />
                            <telerik:TreeListBoundColumn DataField="SampleNumber" UniqueName="SampleNumber" HeaderText="Sample Number"
                                ReadOnly="true" />
                            <telerik:TreeListBoundColumn DataField="StatusId" UniqueName="StatusId" HeaderText="Status"
                                HeaderStyle-Width="75" ReadOnly="true" />
                            <telerik:TreeListBoundColumn DataField="InitialAmount" UniqueName="InitialAmount"
                                HeaderText="Initial Amount" HeaderStyle-Width="100" />
                            <telerik:TreeListBoundColumn DataField="UnitId" UniqueName="UnitId" HeaderText="Units"
                                HeaderStyle-Width="50" ReadOnly="true" />
                            <telerik:TreeListBoundColumn DataField="TubeTypeId" UniqueName="TubeTypeId" HeaderText="Tube Type"
                                HeaderStyle-Width="100" ReadOnly="true" />
                            <telerik:TreeListBoundColumn DataField="Notes" UniqueName="Notes" HeaderText="Notes" />
                            <telerik:TreeListBoundColumn DataField="ParentSample" UniqueName="ParentSample" HeaderText="Parent Sample"
                                ReadOnly="true" />
                            <telerik:TreeListEditCommandColumn UniqueName="EditCommandColumn" ButtonType="LinkButton"
                                ShowAddButton="false" />
                            <telerik:TreeListTemplateColumn UniqueName="Deletecol" ReadOnly="true">
                                <ItemTemplate>
                                    <asp:LinkButton ID="link1" Text="Delete" OnClientClick="if (!confirm('Are you sure?')) return false;"
                                        CommandName="Delete" runat="server" />
                                    <asp:HiddenField ID="ParentSample" Value='<%# Eval("ParentSample")%>' runat="server" />
                                </ItemTemplate>
                            </telerik:TreeListTemplateColumn>
                        </Columns>
                        <NoRecordsTemplate>
                            <div class="message information">
                                <h2>
                                    No samples added yet.</h2>
                                <p>
                                    &nbsp;</p>
                            </div>
                        </NoRecordsTemplate>
                    </telerik:RadTreeList>
                </fieldset>
            </telerik:RadAjaxPanel>
            <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderAddEditSample" runat="server"
                TargetControlID="hiddenTargetControlForModalPopup" PopupControlID="PanelSamples"
                BackgroundCssClass="modalBackground" DropShadow="true">
            </ajaxToolkit:ModalPopupExtender>
            <asp:Panel ID="PanelSamples" runat="server" Style="displaynone" CssClass="modalPopup"> 
    			<asp:UpdatePanel ID="UpdatePanel1" runat="server">                
    				<ContentTemplate>
    					<table class="normal" cellpadding="0" cellspacing="0" border="0">
    						<thead>
    							<tr>
    								<td>
    									<asp:Label ID="Label1" runat="server" Text="Add"></asp:Label> sample
    								</td>		
    								<td align="right">                                    
    									<asp:UpdateProgress ID="UpdateProgress1" runat="server">
    										<ProgressTemplate>
    											<img src="assets/ajax-loader.gif" alt="spinning wheel"/>                                            
    										</ProgressTemplate>                                        
    									</asp:UpdateProgress>                                                                                
    								</td>										
    							</tr>
    						</thead>
    						<tbody>
    							<tr>
    								<td colspan="2">                            
    									<fieldset>
    										<legend>Sample Data</legend>
    										<p>
    												<label>
    												<b><asp:Label ID="LabelSampleNumber" runat="server" Text="Number"></asp:Label></b>
    												</label>
    												<asp:Label ID="TextBoxsampleNumber" runat="server" CssClass="demoHeaders"></asp:Label>                                                
    										</p>
    										<p><label>Sample Type Received</label><asp:DropDownList ID="DropDownListSampleType" 
    												runat="server" AutoPostBack="True" 
    												onselectedindexchanged="DropDownListSampleType_SelectedIndexChanged">
    									</asp:DropDownList><asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
    													ControlToValidate="DropDownListSampleType" CssClass="validate_error" 
    													ErrorMessage="Sample type is required." InitialValue="-1" 
    													Text="Sample type is required."></asp:RequiredFieldValidator></p>
    													<p>
    													<label>
    													Tube Type</label><asp:DropDownList ID="DropDownListTubetype" runat="server" 
    															onselectedindexchanged="DropDownListTubetype_SelectedIndexChanged" AutoPostBack="true">
    													</asp:DropDownList>
    													<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
    														ControlToValidate="DropDownListTubetype" CssClass="validate_error" 
    														ErrorMessage="Tube type is required." InitialValue="-1" 
    														Text="Tube type is required."></asp:RequiredFieldValidator>
    											</p>
    										<p><label>Date Collected</label><asp:TextBox ID="TextBoxDateCollected" runat="server" 
    													CssClass="sf"></asp:TextBox>(mm/dd/yyyy) <asp:CompareValidator ID="CompareValidator1" ControlToValidate="TextBoxDateCollected" Type="Date" Operator="DataTypeCheck"
    														runat="server" ErrorMessage="Date is not valid." Text="Date is not valid." CssClass="validate_error"></asp:CompareValidator>
    													<!--calendar control for date collected-->
    													<ajaxToolkit:CalendarExtender ID="CalendarExtenderDateCollected" runat="server" TargetControlID="TextBoxDateCollected" Animated="true" CssClass="MyCalendar">
    													</ajaxToolkit:CalendarExtender>
    													<!--end calendar control-->
    											</p>                                        
    											<p>
    												<label>
    												Date Received</label><asp:TextBox ID="TextBoxDateReceived" runat="server" 
    													CssClass="sf"></asp:TextBox>(mm/dd/yyyy) <asp:CompareValidator ID="CompareValidator2" ControlToValidate="TextBoxDateReceived" Type="Date" Operator="DataTypeCheck"
    														runat="server" ErrorMessage="Date is not valid." Text="Date is not valid." CssClass="validate_error"></asp:CompareValidator>
    													<!--calendar control for date collected-->
    													<ajaxToolkit:CalendarExtender ID="CalendarExtenderDateReceived" runat="server" TargetControlID="TextBoxDateReceived" Animated="true" CssClass="MyCalendar">
    													</ajaxToolkit:CalendarExtender>
    													<!--end calendar control-->
    											</p>                                            
    											<p>
    												<label>
    												Sample Status</label><asp:DropDownList ID="DropDownListSampleStatus" 
    													runat="server" 
    													onselectedindexchanged="DropDownListSampleStatus_SelectedIndexChanged">
    												</asp:DropDownList>
    												<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
    													ControlToValidate="DropDownListSampleStatus" CssClass="validate_error" 
    													ErrorMessage="Sample status is required." InitialValue="-1" 
    													Text="Sample status is required."></asp:RequiredFieldValidator>
    											</p>                                            
    											<p>
    												<label>Initial Amount</label>
    													<asp:TextBox ID="TextBoxInitialAmount" runat="server" CssClass="sf"></asp:TextBox>
    											</p>
    											<p>    
    												<label>Units</label>
    													<asp:TextBox ID="TextBoxUnits" runat="server" CssClass="sf" ReadOnly="true"></asp:TextBox><asp:RequiredFieldValidator
    														ID="RequiredFieldValidator6" runat="server" ErrorMessage="No units found!" ControlToValidate="TextBoxUnits" CssClass="validate_error"></asp:RequiredFieldValidator>
    											</p>
    											<p>    
    												<label><asp:Label ID="LabelAliquots" runat="server" Text="Number of Aliquots" Visible="false"></asp:Label></label>                                                
    													<asp:TextBox ID="TextBoxAliquots" runat="server" CssClass="sf" ReadOnly="false" Visible="false"></asp:TextBox><asp:RequiredFieldValidator
    														ID="RequiredFieldValidator1" runat="server" ErrorMessage="You must enter the number of aliquots." ControlToValidate="TextBoxAliquots" CssClass="validate_error"></asp:RequiredFieldValidator></p>                                        
    												<p>
    												<label>
    												Notes</label><asp:TextBox ID="TextBoxSampleNotes" runat="server" 
    													CssClass="sf" Rows="2" TextMode="MultiLine"></asp:TextBox>
    											</p>
    									</fieldset>            
    								</td>
    							</tr>
    							<tr>
    								<td align="center">
    								&nbsp;    
    								</td>
    							</tr>
    						</tbody>
    					</table>		
    				</ContentTemplate>
    			</asp:UpdatePanel>                        
    			<asp:UpdatePanel ID="UpdatePanel2" runat="server">
    				<ContentTemplate>
    					<asp:LinkButton ID="LinkButtonSavePopup" CssClass="button" runat="server" 
    						CausesValidation="false" onclick="LinkButtonSavePopup_Click"><span class="ui-icon ui-icon-disk"></span>Save</asp:LinkButton>
    					<asp:LinkButton ID="LinkButtonCancelPopup" CssClass="button" runat="server" CausesValidation="false" onclick="LinkButtonCancelPopup_Click"><span class="ui-icon ui-icon-circle-close"></span>Cancel</asp:LinkButton>						                        	
    				</ContentTemplate>            
    			</asp:UpdatePanel>
    			
    		</asp:Panel>
        </div>
        </form>
    </body>
    </html>
    


    And this is the code behind (Default2.aspx.cs):

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    public partial class Default2 : System.Web.UI.Page
    {
        class DataTest
        {
            private DateTime dateReceived;
     
            public DateTime DateReceived
            {
                get { return dateReceived; }
                set { dateReceived = value; }
            }
            private DateTime dateCollected;
     
            public DateTime DateCollected
            {
                get { return dateCollected; }
                set { dateCollected = value; }
            }
            private string sampleNumber;
     
            public string SampleNumber
            {
                get { return sampleNumber; }
                set { sampleNumber = value; }
            }
            private string status;
     
            public string StatusId
            {
                get { return status; }
                set { status = value; }
            }
            private float initialAmount;
     
            public float InitialAmount
            {
                get { return initialAmount; }
                set { initialAmount = value; }
            }
            private string units;
     
            public string UnitId
            {
                get { return units; }
                set { units = value; }
            }
            private string tubeType;
     
            public string TubeTypeId
            {
                get { return tubeType; }
                set { tubeType = value; }
            }
            private string notes;
     
            public string Notes
            {
                get { return notes; }
                set { notes = value; }
            }
            private string parentSample;
     
            public string ParentSample
            {
                get { return parentSample; }
                set { parentSample = value; }
            }
        }
     
        protected void Page_Load(object sender, EventArgs e)
        {
     
        }
     
        private void BindData()
        {
            DataTest sample1 = new DataTest();
            sample1.DateReceived = DateTime.Now;
            sample1.DateCollected = DateTime.Now;
            sample1.SampleNumber = "1";
            sample1.StatusId = "NA";
            sample1.InitialAmount = 9.0f;
            sample1.UnitId = "ml";
            sample1.TubeTypeId = "ACD";
            sample1.Notes = "Notes sample 1";
            sample1.ParentSample = null;
     
            DataTest sample2 = new DataTest();
            sample2.DateReceived = DateTime.Now.AddDays(1);
            sample2.DateCollected = DateTime.Now.AddDays(1);
            sample2.SampleNumber = "2";
            sample2.StatusId = "AVAIL";
            sample2.InitialAmount = 0.0f;
            sample2.UnitId = "ml";
            sample1.TubeTypeId = "Cryovial";
            sample2.Notes = "Notes sample 2";
            sample2.ParentSample = "1";
     
            List<DataTest> rows = new List<DataTest>();
            rows.Add(sample1);
            rows.Add(sample2);
            RadTreeListSamples.DataSource = rows;
        }
     
        protected void DropDownListStudy_SelectedIndexChanged(object sender, EventArgs e)
        {
     
        }
     
        protected void LinkButtonAddEditSample_Click(object sender, EventArgs e)
        {
     
        }
     
        protected void RadTreeListSamples_ItemDataBound1(object sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e)
        {
     
        }
     
        protected void RadTreeListSamples_UpdateCommand1(object sender, Telerik.Web.UI.TreeListCommandEventArgs e)
        {
            RadWindowManagerUI.RadAlert("This is getting updated!", 330, 100, "DNA CellLab"null);
        }
     
        protected void RadTreeListSamples_NeedDataSource1(object sender, Telerik.Web.UI.TreeListNeedDataSourceEventArgs e)
        {
            BindData();
        }
     
        protected void RadTreeListSamples_ItemCommand(object sender, Telerik.Web.UI.TreeListCommandEventArgs e)
        {
     
        }
        protected void DropDownListSampleType_SelectedIndexChanged(object sender, EventArgs e)
        {
     
        }
        protected void DropDownListTubetype_SelectedIndexChanged(object sender, EventArgs e)
        {
     
        }
        protected void DropDownListSampleStatus_SelectedIndexChanged(object sender, EventArgs e)
        {
     
        }
        protected void LinkButtonSavePopup_Click(object sender, EventArgs e)
        {
     
        }
        protected void LinkButtonCancelPopup_Click(object sender, EventArgs e)
        {
     
        }
    }
    


    Please let me know if you can catch what I am missing, because, again, the update event does not fire.

    Thanks!
  7. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 23 Jan 2012 Link to this post

    Hello Chris,

    I ran your latest code and found out the problem. It is that the RequiredFieldValidators in the Panel shown by the ModalPopUpExtender prevent the Update button from submitting the page. You could fix this by setting a different ValidationGroup for the RadTreeList:
    <telerik:RadTreeList ......>
        <ValidationSettings ValidationGroup="treeListGroup" />
    </telerik:RadTreeList>

    Also, keep in mind that the same problem will expose if you have other controls trying to submit the page, therefore, you may consider declaring a ValidationGroup for these validators, so that they validate only the related textboxes.

    Regards,
    Tsvetina
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017