or
Hello,
I can't figure out how to reference a RadioButtonList in a RadGrid GRidtemplate column header template:
| <Columns> |
| <telerik:GridTemplateColumn DataField="cd_nr" HeaderText="cdNr" UniqueName="cdNr"> |
| <HeaderTemplate> |
| <asp:RadioButtonList ID="rbtnLst_cdNo" runat="server" RepeatDirection="Vertical"> |
| <asp:ListItem Text="1" Value="1"></asp:ListItem> |
| </asp:RadioButtonList> |
| </HeaderTemplate> |
In codebehind, I have:
RadioButtonList selCd = rGrd_trckList.MasterTableView.FindControl("rbtnLst_cdNo") as RadioButtonList;
but that's just null.
What am I missing?
knut
| protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args) |
| { |
| string[] values = args.Value.Split('|'); |
| if (values.Length > 0) |
| { |
| this.UpdateToolTip(values[0], args.UpdatePanel, int.Parse(values[1])); |
| } |
| } |
| private void UpdateToolTip(string section, UpdatePanel update, int index) |
| { |
| ToolTipContent ctl = (ToolTipContent)Page.LoadControl("tooltipcontent/" + section + ".ascx"); |
| ctl.SetIndex(index); //This sets the values of the controls |
| update.ContentTemplateContainer.Controls.Add(ctl); |
| //At this point (and after) the controls look like they are set correctly in the code |
| //it is only when the tooltip is loaded that it shows incorrectly. |
| } |
| <telerik:RadToolTipManager ID="tltAvailability" runat="server" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Element" |
| ShowEvent="OnClick" HideEvent="ManualClose" |
| Position="MiddleLeft" Animation=FlyIn RenderInPageRoot="true" Width="250" Height="200" |
| ></telerik:RadToolTipManager> |
| <%@ Control Language="C#" AutoEventWireup="true" CodeFile="repAvailability.ascx.cs" Inherits="cox.applications.web.ehealth.physicianreferral.AvailabilityToolTip" %> |
| <%@ Reference Control="~/tooltipcontent/ToolTipContent.ascx" %> |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <script type="text/javascript"> |
| </script> |
| <asp:FormView ID="fvwAvailability" runat="server" OnItemCreated="CreatedFormItem" OnItemCommand="fvwAvailability_ItemCommand" > |
| <ItemTemplate> |
| Type of Availability:<br /> |
| <telerik:RadComboBox ID="ddlTypes" runat="server" DataValueField="ID" DataTextField="Description" ZIndex="10000" |
| AutoPostBack="true" OnSelectedIndexChanged="SelectedType"> |
| </telerik:RadComboBox><br /> |
| Age Available:<br /> |
| <asp:TextBox ID="txtAge" runat="server" Width="75px" ></asp:TextBox><br /> |
| Range of Availbility:<br /> |
| <telerik:RadComboBox ID="ddlRange" runat="server" DataTextField="Description" DataValueField="ID" ZIndex="10000" > |
| </telerik:RadComboBox><br /> |
| </ItemTemplate> |
| </asp:FormView> |
| <asp:Button ID="btnSave" runat="server" OnClick="SaveClicked" Text="Save" UseSubmitBehavior="false" /> |
| protected void OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args) |
| { |
| _currentPhysician = Shared.CurrentPhysician; |
| string[] values = args.Value.Split('|'); |
| if (values.Length > 0) |
| { |
| Control saveButton = this.UpdateToolTip(values[0], args.UpdatePanel, int.Parse(values[1])); |
| } |
| } |
| private Control UpdateToolTip(string section, UpdatePanel update, int index) |
| { |
| ToolTipContent ctl = (ToolTipContent)Page.LoadControl("tooltipcontent/" + section + ".ascx"); |
| ctl.SetIndex(index); |
| update.ContentTemplateContainer.Controls.Add(ctl); |
| return ctl.SaveButton; |
| } |
| /* THIS CODE IS FROM THE USER CONTROL */ |
| public void SetIndex(int index) |
| { |
| _index = index; |
| SetDataSource(); |
| } |
| protected override void SetDataSource() |
| { |
| if (this._index >= 0) |
| { |
| List<AvailabilityInfo> inf = Shared.CurrentPhysician.AvailabilityInfo; |
| fvwAvailability.DataSource = (from i in inf |
| where inf.IndexOf(i) == this._index |
| select i); |
| _baseInfo = (ApprovableItem)fvwAvailability.DataItem; |
| } |
| else |
| { |
| fvwAvailability.DataSource = null; |
| _baseInfo = new ApprovableItem(Null.NullInteger, StatusType.Pending, Null.NullInteger, Null.NullDate, Shared.User, Null.NullString); |
| } |
| fvwAvailability.DataBind(); |
| } |
| protected void SaveClicked(object sender, EventArgs e) |
| { |
| SaveInfo(); |
| } |
| protected void grdAnnouncements_PreRender(object sender, System.EventArgs e) |
| { |
| foreach (GridItem item in grdAnnouncements.MasterTableView.Items) |
| { |
| item.Edit = true; |
| } |
| } |
| Private Sub MakeGraph(ByVal myyear As Int32, ByVal _Val1 As String, ByVal _val2 As String) |
| Dim table As DataTable |
| table = Get52WeekGraph |
| rctrend.DataSource = table |
| rctrend.DataBind() |
| rctrend.PlotArea.XAxis.DataLabelsColumn = "weekname" |
| Dim series1 As New Telerik.Charting.ChartSeries() |
| Dim series2 As New Telerik.Charting.ChartSeries() |
| rctrend.Series.Clear() |
| Dim minval As Double = 1000000 |
| Dim maxval As Double = 0 |
| For Each rowView As DataRowView In table.DefaultView |
| Dim seriesItem1 As New Telerik.Charting.ChartSeriesItem() |
| seriesItem1.Label.Visible = False |
| If Not IsDBNull(rowView("tyval")) Then |
| seriesItem1.YValue = CDbl(rowView("tyval")) |
| If seriesItem1.YValue < minval Then minval = seriesItem1.YValue |
| If seriesItem1.YValue > maxval Then maxval = seriesItem1.YValue |
| series1.DataLabelsColumn = rowView("weekname") |
| End If |
| series1.AddItem(seriesItem1) |
| Dim seriesItem2 As New Telerik.Charting.ChartSeriesItem() |
| seriesItem2.Label.Visible = False |
| If Not IsDBNull(rowView("lyval")) Then |
| seriesItem2.YValue = CDbl(rowView("lyval")) |
| If seriesItem2.YValue < minval Then minval = seriesItem2.YValue |
| If seriesItem2.YValue > maxval Then maxval = seriesItem2.YValue |
| series1.DataLabelsColumn = rowView("weekname") |
| End If |
| series2.AddItem(seriesItem2) |
| Next |
| series1.Name = _Val1 |
| series2.Name = _val2 |
| Dim valdiff As Double |
| Dim mybuff As Double |
| Dim mystep As Double |
| valdiff = maxval - minval |
| mybuff = valdiff * 0.2 |
| minval = CInt(minval - mybuff) |
| maxval = CInt(maxval + mybuff) |
| mystep = (maxval - minval) / 10 |
| rctrend.Series.Add(series1) |
| rctrend.Series.Add(series2) |
| rctrend.PlotArea.Chart.DefaultType = Telerik.Charting.ChartSeriesType.Line |
| rctrend.PlotArea.YAxis.AutoScale = False |
| rctrend.PlotArea.YAxis.IsZeroBased = False |
| rctrend.PlotArea.YAxis.MinValue = minval |
| rctrend.PlotArea.YAxis.MaxValue = maxval |
| rctrend.PlotArea.YAxis.Step = mystep |
| rctrend.PlotArea.XAxis.MaxValue = 52 |
| rctrend.ChartTitle.TextBlock.Text = "Score" |
| End Sub |