Hello all,
I have this page:
With this Code behind:
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...
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> </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...