Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
277 views
Have a page that displays some notes from our database and as it will display properly for a certain type of notes.  However it doesn't display for our Board Report notes where the databinding is done a bit differently.  Wondering if you could spot our problem and help us with solving this mystery.  It will load the Master level records but list "No child records to display".

The DetailView.jpg will show how the Board Report notes are to be displayed but NoRecordChildView.jpg is what it comes out to be.  How do we bind the detail grid? 

<telerik:radgrid id="_grdNotes" runat="server" cellspacing="-1" datasourceid="SqlDataSource1"  showheader="False" gridlines="None" style="margin-bottom: 0px;">
            <MasterTableView DataSourceID="SqlDataSource1" HierarchyLoadMode="Client" AutoGenerateColumns="False" DataKeyNames="SubNoteID" Name="Parent" GridLines="None">
                 <DetailTables >
                    <telerik:GridTableView HierarchyLoadMode="Client"  DataKeyNames="SubNoteID" DataSourceID="_srcSubNotes" Width="100%" runat="server" EnableHeaderContextMenu="false" Name="Child" AutoGenerateColumns="False" GridLines="None">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="SubNoteID" MasterKeyField="SubNoteID">
                            </telerik:GridRelationFields>
                        </ParentTableRelation>
                        <Columns>
                            <telerik:GridTemplateColumn DataField="Comments" FilterControlAltText="Filter Comments column" HeaderText="Comments" SortExpression="Comments" UniqueName="Comments">
                                <ItemTemplate>
                                    <b>(<asp:Label ID="CreatedOnLabel" runat="server" Text='<%#  Eval("FormatedCreatedOn")  %>' ></asp:Label> - <asp:Label ID="FullNameLabel" runat="server" Text='<%# Eval("FullName") %>'></asp:Label>) </b>
                                    <asp:Label ID="CommentsLabel" runat="server" Text='<%# Eval("Comments") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn UniqueName="UploadedFiles" FilterControlAltText="Filter UploadedFiles column" >
                                <ItemTemplate>
                                    <asp:HiddenField ID="_hdnNoteID" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "NoteID")%>' />
                                    <ul>
                                        <asp:Repeater ID="_rptNoteFiles" runat="server">
                                            <ItemTemplate>
                                                <li><asp:HyperLink runat="server" ID="_hlNoteFile" NavigateUrl='<%# "~/NoteFiles/" & DataBinder.Eval(Container.DataItem, "FileLoc")%>' Text='<%# DataBinder.Eval(Container.DataItem,"FileDesc") %>'></asp:HyperLink></li>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </ul>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <telerik:GridTemplateColumn DataField="CorrectFollowUpDate" FilterControlAltText="Filter CorrectFollowUpDate column" HeaderText="CorrectFollowUpDate" SortExpression="CorrectFollowUpDate" UniqueName="CorrectFollowUpDate">
                        <ItemTemplate>
                            <b>Follow-up Date: </b>
                            <asp:Label ID="CorrectFollowUpDateLabel" runat="server" Text='<%# Eval("CorrectFollowUpDate") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter Status column" HeaderText="Status" SortExpression="Status" UniqueName="Status">
                        <ItemTemplate>
                            <asp:HiddenField ID="_hdnCompleted" Value='<%# Eval("Completed") %>' runat="server" />
                            <asp:HiddenField ID="_hdnIncomplete" Value='<%# Eval("Incomplete") %>' runat="server" />
                            <b>Status: <asp:Label ID="StatusLabel" runat="server"></asp:Label></b>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn FilterControlAltText="Filter Add column" UniqueName="AddComplete" HeaderText="" SortExpression="AddComplete">
                        <ItemTemplate>
                            <asp:HiddenField ID="_hdnNoteIDAdd" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "NoteID")%>' />
                            <a onclick='<%# "AddCompleteNote(" & Eval("NoteID") & ");"%>' href="javascript:void(0);">Add/Complete Note</a>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
        </telerik:radgrid>
    </div>
</div>
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='<%$ ConnectionStrings:FMS_Conn %>' SelectCommand="sp_getFMSNotes" SelectCommandType="StoredProcedure">
    <SelectParameters>
        <asp:SessionParameter SessionField="charter_num" Name="charter_num" Type="Int32"></asp:SessionParameter>
        <asp:QueryStringParameter QueryStringField="Section" Name="Section" Type="String"></asp:QueryStringParameter>
    </SelectParameters>
</asp:SqlDataSource>
 <asp:SqlDataSource ID="_srcNoteFiles" runat="server"  ConnectionString='<%$ ConnectionStrings:FMS_Conn %>' SelectCommand="sp_getFMSNoteFiles" SelectCommandType="StoredProcedure">
    <SelectParameters>
            <asp:Parameter Name="NoteID" Type="Int32" ></asp:Parameter>
    </SelectParameters>
</asp:SqlDataSource>
 <asp:SqlDataSource ID="_srcSubNotes" runat="server"  ConnectionString='<%$ ConnectionStrings:FMS_Conn %>' SelectCommand="sp_getFMSSubNotes" SelectCommandType="StoredProcedure">
    <SelectParameters>
           <asp:ControlParameter ControlID="_grdNotes" Name="SubNoteID" PropertyName="DataMember" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>


Private Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender
     _dateFollowUpAdd.MinDate = DateTime.Today.Date.AddDays(1)
 
     If Request("Section") = "FMS-Board" And clscommon.RecursiveFindControl(Page, "_hdnBoardRptID") IsNot Nothing Then
         oConn.Open()
         Dim ocmd As New SqlCommand("sp_seBoardRptFMSNotes", oConn)
         ocmd.CommandType = CommandType.StoredProcedure
         With ocmd.Parameters
             Dim hdnBoardRptID As HiddenField = CType((clscommon.RecursiveFindControl(Page, "_hdnBoardRptID")), HiddenField)
             .Add(New SqlParameter("@BoardRptID", hdnBoardRptID.Value))
         End With
         _grdNotes.DataSourceID = Nothing
         _grdNotes.DataSource = ocmd.ExecuteReader
         _grdNotes.DataBind()
         '_srcSubNotes.DataBind()
         '_grdNotes.MasterTableView.DetailTables(0).DataSourceID = "_srcSubNotes"
         '_grdNotes.MasterTableView.DetailTables(0).Rebind()
         oConn.Close()
     End If
 End Sub




















Ryan
Top achievements
Rank 1
 answered on 11 Sep 2014
1 answer
131 views
Hi All,

I've looked into this before and on finding nothing gave up for a while but is there any equivalent functionality in the TreeList to the RadGrid's CommandItemTemplate or is this a roll your own affair.  Whilst I don't mind doing my own one it's always nice to have similar functionality between controls - especially as that ensures skin compliance.

Ideally we could have a top and a bottom command template so that the bottom one could contain any information such as a key for any icons used in the list.

Regards

Jon
Eyup
Telerik team
 answered on 11 Sep 2014
1 answer
195 views
I'm using the RadListBox as is shown in the screenshot.  Through JavaScript I'm able to correctly distinguish between single and double left clicks.

Looking at my code (about a year old now), I see that I had tried introducing the RadContextMenu to the RadListBox but had disabled it.  I don't think it was quite working ideally.  But my client is hoping I could introduce a context menu.   Essentially what I'd like the user to be able to do is right click over top of any of the RadListBox items and a simple context menu appear.  The *problem* is that I don't know know how to determine which RadListBox item is being right clicked upon.

It's important to understand that I do NOT want to force the user to first left click a RadListBox item.  They should just be able to immediately right click over top of it.

So how do I determine which RadListBox item they're right clicking over top of?

Robert
Nencho
Telerik team
 answered on 11 Sep 2014
1 answer
89 views
I'm having some trouble with filter menus. When I first load the page, I don't have menus when I click the filter buttons.

I then filter using the CurrentFilterFunction="Contains" setting and pressing <tab>, a postback occurs, and now my filter buttons have the column header menus (Sort Ascending..., Group By, Best fit, etc.)

Any ideas why or what I can do to get and keep the proper filter menus?

C#
protected override void OnPreRender(System.EventArgs e)
{
    // ... Control setup unrelated to RadGrid1
  
    // Test filtering
    bool Filter = true;
    if (Filter)
    {
        RadGrid1.AllowFilteringByColumn = Filter;
        RadGrid1.MasterTableView.AllowFilteringByColumn = Filter;
    }
}

// I've also got handlers for these, but they don't setup filtering:

            RadGrid1.PreRender += RadGrid1_PreRender;
            RadGrid1.ItemCreated += RadGrid1_ItemCreated;
            RadGrid1.ItemDataBound += RadGrid1_ItemDataBound;
            RadGrid1.NeedDataSource += RadGrid1_NeedDataSource;
            RadGrid1.GroupsChanging += RadGrid1_GroupsChanging;



ASCX
<telerik:RadGrid EnableViewState="true" ID="RadGrid1" runat="server" AllowSorting="True" AllowPaging="True" GridLines="None" PageSize="25" AutoGenerateColumns = "false"
                    OnExcelMLWorkBookCreated="RadGrid1_ExcelMLWorkBookCreated" OnItemCreated="RadGrid1_ItemCreated" OnHTMLExporting="RadGrid1_HtmlExporting"
                    AllowMultiRowSelection="True" ShowFooter="true" ShowGroupPanel="True" EnableHeaderContextMenu="true"  Skin="Xledger" EnableEmbeddedSkins="false" style="z-index: 0;">
 
                    <PagerStyle AlwaysVisible="true" />
 
                     <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
                        <Pdf PageHeight="210mm" PageWidth="297mm" DefaultFontFamily="Arial Unicode MS" PageTopMargin="45mm" BorderStyle="Medium" BorderColor="#666666"></Pdf>
                    </ExportSettings>
 
                    <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true" ColumnsReorderMethod="Reorder" AllowDragToGroup="true">
 
                        <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True" AllowColumnResize="True" AllowResizeToFit="true"></Resizing>
                        <Selecting AllowRowSelect="true" />
                        <Scrolling AllowScroll="false"/><%--<Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="2"></Scrolling> --%>
 
                    </ClientSettings>
 
                    <GroupingSettings ShowUnGroupButton="true" RetainGroupFootersVisibility="true"></GroupingSettings>
  
                    <MasterTableView ShowGroupFooter="true" TableLayout="Auto"  Width="100%" AllowMultiColumnSorting="true" AllowGroupCollapse="true" GroupLoadMode="Client" EnableGroupsExpandAll="true">
 
                        <%-- AUTOGROUP BY ACCOUNT GROUP
                         <GroupByExpressions>
                          <telerik:GridGroupByExpression>
                            <SelectFields>
                              <telerik:GridGroupByField FieldName="t_rv_account_group" />
                            </SelectFields>
                            <GroupByFields>
                              <telerik:GridGroupByField FieldName="t_rv_account_group" />
                            </GroupByFields>
                          </telerik:GridGroupByExpression>
                        </GroupByExpressions>
                        --%>
 
                        <Columns>
                            <telerik:GridBoundColumn UniqueName="trvAccountGroup" DataField="t_rv_account_group" DataType="System.String" HeaderText="trvAccountGroup"  AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn UniqueName="trvSysAccount" DataField="t_rv_sys_account" DataType="System.String" HeaderText="trvSysAccount"></telerik:GridBoundColumn>
 
<%-- ... more columns ... --%>
 
 
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>

Kostadin
Telerik team
 answered on 11 Sep 2014
1 answer
160 views
Hello,

I am using RadGrid (version 2014.1.403.45) and I need to export a header to PDF, Excel, and CSV.  For PDF, this is accomplished easily, by using the "Pdf-PageTitle" property on the <ExportSettings>.  Is there something similar for Excel and CSV?  If not, is there a workaround?

Thanks,
Steve
Kostadin
Telerik team
 answered on 11 Sep 2014
1 answer
68 views
Whenever I double click on an appointment that is created it takes me to an appointment that belongs in the same resource grouping but one that was created at an earlier date. Any suggestions?
Boyan Dimitrov
Telerik team
 answered on 11 Sep 2014
2 answers
152 views
We're using the RadTreeView to show a hierarchical structure.

Since our data does not follow the format required, (parentid, id, text), we are creating a datatable on the fly, adding values (and additional attributes) and binding. Now the user can add more information to the tree.

When the user is done, we want to access all the data from the tree, convert it to our format and save it back to the database.

The question is: can I access the datatable as it is? For every edit, I'm adding the required data to the datatable (using node attributes).

If not, what is the best way to get all the data out and write it in my required format?

Thanks in Advance.
Boyan Dimitrov
Telerik team
 answered on 11 Sep 2014
1 answer
123 views
In the AddAjaxSetting(Control ajaxifiedControl, Control updatedControl) method, is it ok for both Control arguments to be the same object? For example:

radAjaxMgr1.AjaxSettings.AddAjaxSetting(myCustomEditor, myCustomEditor);

 myCustomEditor is of the type WebControl. It looks like myCustomEditor is going to respond to some client-side action on itself, but is that allowed by the RadAjaxManager?

Thanks!
Konstantin Dikov
Telerik team
 answered on 11 Sep 2014
10 answers
544 views
Hi,

I'm using a radgrid with a templated edit form and popup edit mode. Most of my validators are requireduiredfieldvalidators but one of my fields need to be validated agains the database. I therefore need to use a CustomValidator which is OK but if I do the validation server side then the error is not shown at the same time as the client side validator errors in the validationsummary.

Therefore I'm trying to call an AJAX method in the custom validator:

ClientValidationFunction="InitiateAsyncRequest('this.id')";

This calls the a server side method:

  public void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)

In this method I would like to perform the validation and then set the IsValid flag on the customervalidator. The problem I am having is finding the CustomValidator control in the AjaxRequest method on the server. The SelectedItems property on the RadGrid is empy and RadGrid.FindControl("Customvalidator1") returns null. Is this possible? Or is there an easier way to do this?

Thanks, Stuart


Maria Ilieva
Telerik team
 answered on 11 Sep 2014
1 answer
101 views
I have a RadGrid which uses InPlace editing, and this grid contains a RadComboBox and a RadTextBox. When the user changes the text choice of the RadTextBox, the value behind the choice is used to retrieve data using AutoPostBack, and the returned data needs to update the text value of the RadTextBox.

Here's what the .aspx code looks like:

<telerik:RadGrid ID="rgvMsgElementToMsgTemplate" runat="server" GridLines="None" AutoGenerateColumns="false" MasterTableView-NoMasterRecordsText="No Records To Display">
    <MasterTableView CommandItemDisplay="Top" NoDetailRecordsText="No Records To Display" EditMode="InPlace">
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                <HeaderStyle Width="50px" />
            </telerik:GridEditCommandColumn>
            <telerik:GridTemplateColumn DataField="TMPLT_NM" HeaderText="Template" UniqueName="TMPLT_NM">
                 <HeaderStyle Width="200px" />
                 <ItemTemplate>
                     <asp:LinkButton ID="lblMessageTemplate" CommandName="EDIT" runat="server" Text='<%#Container.DataItem("TMPLT_NM")%>' />                                                                                   
                 </ItemTemplate>
                 <InsertItemTemplate>
                    <telerik:RadComboBox runat="server" ID="rcbTemplate" DataTextField="TMPLT_NM" DataValueField="AMCAT_ID" Width="190px" DropDownAutoWidth="Enabled"
                        OnSelectedIndexChanged="rcbTemplate_SelectedIndexChanged" AutoPostBack="true"></telerik:RadComboBox>
                    <asp:RequiredFieldValidator ID="rcbTemplateValidator" CssClass="redreq" ControlToValidate="rcbTemplate" InitialValue="-- Select an Item --" runat="server" ErrorMessage="*"></asp:RequiredFieldValidator>
                 </InsertItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn HeaderText="Version Id" UniqueName="TMPLT_VRS_ID" DataField="TMPLT_VRS_ID">
                <HeaderStyle Width="50px" />
                <ItemTemplate>
                    <%# Eval("TMPLT_VRS_ID")%>
                </ItemTemplate>
                <InsertItemTemplate>
                    <telerik:RadTextBox runat="server" ID="rtbVersion" DataField="TMPLT_VRS_ID" readonly="true" Width="50px"></telerik:RadTextBox>
                </InsertItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

My issue is that inside the SelectedIndexChanged event, I don't know how to access the InsertItem(s) defined in the .aspx from within this event. I have tried to use the NamingContainer, EditItems collection, the GetInsertItems() function, using a Try/DirectCast to FindControl to no avail.


Public Sub rcbTemplate_SelectedIndexChanged(sender As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)
 
' Somewhere in here I need to get to the each item inside the InPlace edit section of the grid...
 
End Sub

Is this even possible?

Thanks.

Jim











Eyup
Telerik team
 answered on 11 Sep 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?